jsonapi-rb / jsonapi-rails

Rails gem for fast jsonapi-compliant APIs.
http://jsonapi-rb.org
MIT License
320 stars 63 forks source link

Consider generating (de)serializable resources in `app/resources`. #13

Closed beauby closed 7 years ago

beauby commented 7 years ago

Current behavior

Generated (de)serializable resources are written to app/serializable/ and app/deserializable.

Suggested modification

Generated (de)serializable resources are written to app/resources/.

richmolj commented 7 years ago

Would the class name also change? PostResource instead of SerializablePost?

beauby commented 7 years ago

@richmolj The intent here was to have app/resources/serializable_post.rb and app/resources/deserializable_post.rb. I'm quite against merging the definition of the serialization and deserialization interfaces at the moment, though I'm up to discuss it.

richmolj commented 7 years ago

Ah, I see. I am planning on only using deserialization under-the-hood of strong_resources, so I would only ever have app/resources/serializable_post. Since that's actually a resource object, PostResource makes more sense for my particular use case. Not sure if that should be generalized or not atm.

beauby commented 7 years ago

As long as you name your class PostResource (for autoloading) and configure the inferrer accordingly, you're free to use any naming.

beauby commented 7 years ago

Closing this for now as generators are not a priority.