sails-swagger icon indicating copy to clipboard operation
sails-swagger copied to clipboard

Default Models (contact and group) - primary key association issue

Open bcsridhar opened this issue 7 years ago • 2 comments

  1. I've installed sails-swagger and swagger-ui.
  2. When I do sails lift I get an error - Trying to create an association on a model that doesn't have a Primary Key.
  3. This error is due to the default models (contact and group) that are part of sails-swagger package under dist/api/models
  4. These 2 models do not have a primary key specified and hence the above error. If I edit the above models and include a primary key it works with out any issue and i am able to view the documentation.
  5. Editing the models in the package is not an option, so i do i get around this issue

bcsridhar avatar Mar 13 '18 14:03 bcsridhar

the reason for the 2 included models (contact and group) to exist, is just for testing purpose. You don't need them.

I have forked this project, and made a few updates to it and released an npm package. https://github.com/Alino/sails-swagger https://www.npmjs.com/package/sails-swagger-alino

My fork is using the two test models only while you run the tests with npm test otherwise they will not be compiled in the dist folder.

Alino avatar Mar 21 '18 14:03 Alino

You should not install and use sails-swagger from the npm because it's outdated and not maintained. Rather use your own forked sails-swagger project, or use someones else, with the updates matching your project needs.

Alino avatar Mar 21 '18 14:03 Alino