Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • May 17 17:05
    vinczedani commented #730
  • May 16 05:48
    mathieujobin commented #730
  • May 16 05:44
    mathieujobin commented #759
  • May 13 07:12
    vinczedani edited #759
  • May 12 16:04
    vinczedani opened #759
  • May 12 16:02
    vinczedani commented #730
  • May 12 15:59
    vinczedani commented #730
  • May 12 15:49
    vinczedani commented #730
  • Apr 25 06:52
    danleyden synchronize #710
  • Apr 22 08:13
    LuukvH synchronize #744
  • Apr 21 03:49
    mathieujobin commented #758
  • Apr 21 03:42

    mathieujobin on rails7

    update framework files in dummy… (compare)

  • Apr 21 03:40

    mathieujobin on rails7

    run tests against rails 7.0 update framework files in dummy… (compare)

  • Apr 19 14:16
    voxik commented #758
  • Apr 19 14:14
    voxik opened #758
  • Apr 19 09:25
    ofedoren commented #710
  • Apr 19 09:21
    ofedoren commented #691
  • Apr 19 03:14

    mathieujobin on v0.7.2

    (compare)

  • Apr 19 03:13

    mathieujobin on master

    Release 0.7.2 - Update Changelog (compare)

  • Apr 18 15:01
    mathieujobin commented #745
Jacob Burenstam
@buren
hm.. well I guess thats a kinda valid question ;) I can say that indeed the repo is very active at this point, though I found it stable enough to use for a large-ish project
@damuz91 I’d say it depends on what you need
(I’m for example not using the built in validator beacause it could’t be customized enough to match my needs)
David Muñoz
@damuz91
This message was deleted
This message was deleted
Jacob Burenstam
@buren

also i am looking to extend a functionality

what kind of functionality do you need? @damuz91

David Muñoz
@damuz91

@buren Nice thanks. That customized validation sounds interesting, going to look for it, any advice.

I've noticed that in production an error returns a JSON that says that something has gone wrong, but in development it describes the parameter that i am missing. I'd like the response to be a JSON describing the missing attributes

Jacob Burenstam
@buren

Ok, that was basically what I needed too, though I was also conforming to jsonapi.org so I had to have the response in a certain way.

To me it seemed clear that it would be best to “own” as much of the validation logic as possible.

Are all of the fields required in order to successfully save your model object? (ActiveRecordor something else..)

If you can/should add those validations directly on the model and then you can return those error in whatever format you want

for ActiveRecord it could look something like this:

activerecord_model_instance.errors.messages.flat_map do |attribute, errors|
  errors.map do |error_message|
    {
      attribute: attribute,
      message: error_message
    }
  end
end
David Muñoz
@damuz91
Oh i see what you mean, we should leave the validation to the model and not to the ApiPie acting as a middleware that intercepts the request on the action and before it executes, that's clever, but i am wondering if there is any extension to make in order to leave this validation layer on the Apipie (I know it is not good looking to leave the validation there rather than in the model, but i am curious)
Jacob Burenstam
@buren

@damuz91 hm.. well this being Ruby you can basically do whatever you want, its just a matter of how “risky”/“reckless” one can be ;) I haven’t used that parts, so can’t say that I’m particular familiar with it either but here is the code:

Validation code:
https://github.com/Apipie/apipie-rails/blob/296c097f9acb951149d3a67db69b84eb216bdd7e/lib/apipie/dsl_definition.rb#L219-L254

Error classes:
https://github.com/Apipie/apipie-rails/blob/296c097f9acb951149d3a67db69b84eb216bdd7e/lib/apipie/errors.rb

David Muñoz
@damuz91
@buren Amazing, going to take a look at this
Thanks dude!
Jacob Burenstam
@buren
@damuz91 no worries happy to help :smile:
Sean Handley
@seanhandley
Has anyone successfully added Apipie docs into a Rails engine?
I've converted an existing Rails app into a Rails engine (and the controllers are working fine)
but the /docs path is raising uninitialized constant MyEngine::Apipie
Sean Handley
@seanhandley
Details: Apipie/apipie-rails#516
Jacob Burenstam
@buren
@seanhandley in the Rails engine have you defined apipie-rails as a dependency?
Sean Handley
@seanhandley
Yes @buren
I was able to get it working by taking this approach: Apipie/apipie-rails#127
i.e. defining the apipie-rails dependency in the host application and placing apipie into the routes.rb of that application.
But it's far from ideal because my overrides now need to be placed in the host application's codebase i.e. app/views/layouts/apipie/apipie.html.erb
I'd be much happier if I could get all the apipie specific stuff into the engine codebase then the host application just needs to require the gem and mount it within its routes.
Manuel
@WtfJoke
Is it possible to have the example(s) in a separate file somehow? We have quite big responses and providing a few examples makes the source file huge.
Manuel Tancoigne
@mtancoigne
Hello !
Joni Niemi
@muvox
Quick question! I currently have " Array || Hash " as my endpoint validator, but my docs say only "Array of any type". According to my tests both array and hash work. Is there a way to 'override' what comes under the params description in the docs?