Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Model generator should be called API generator and docs improvement #238

Open
Fr33maan opened this issue Apr 15, 2016 · 5 comments
Open

Comments

@Fr33maan
Copy link

Fr33maan commented Apr 15, 2016

Hi,

I experienced something very strange with model names like coach and person.
Their pluralized forms are coaches and people (try it there) so I tried to create ressources by posting to ``v1/coachesorv1/people` which give me the following response :

{
  "code": "OK",
  "message": "Operation is successfully executed",
  "data": {}
}

Off course, nothing is created, this is not the standard response for ressource creation.

I tried to set pluralize : false and if I ping non pluralized route I get the same response and nothing gets created.

How can I use thoses model names ?

Note that blueprint routes works perfectly in native sails so I guess it comes from the PluralizeHook or other code from this module ?

@Fr33maan
Copy link
Author

Fr33maan commented Apr 15, 2016

Ok it's not a bug at all, you must avoid to create api with Controller generator and then Model generator. Just use Model generator.

Could you write it in capital letters in the doc ? I've seen nowhere that generate controller then model will break blueprints.

Why ? Because when you generate a controller, the generator write an index action inside and this breaks blueprint routes.

And in fact, the Model generator corresponds to the api generator in sails because it generates model AND controller. This should be renamed as it is really confusing.

@Fr33maan Fr33maan changed the title [bug] blueprint routes does not work for some pluralized models name Model generator should be called API generator and docs improvement Apr 15, 2016
@ghaiklor
Copy link
Owner

@Prisonier what you think about contributing in the generator ? I have no time for fixing all the issues that we have already, since I'm working on another open-source project. I can be your mentor and help with PR review.

@Fr33maan
Copy link
Author

@ghaiklor I'm really interested

@ghaiklor
Copy link
Owner

@Prisonier you can pick up any issue then and make PR. Issues are really easy and I always can help you with reviewing and discussing the PRs.

Read the contributing guide first. And don't forgot to install commitizen. I'm using semantic-release, so your commits should be formatted by standard, commitizen helps you with that.

First issue is really issue for first contributing - #225. You need to upgrade sails and other dependencies in generators/app/templates/package.json and check that tests are passing and it generates project locally with Sails 0.12. Any questions to can ask there - #225 :)

@Fr33maan
Copy link
Author

I've added precision in the wiki about what model generator does. I was pretty sure this would create a PR but instead it directly modified the wiki...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants