theoomoregbee / sails-hook-swagger-generator

A tool to help generate Swagger specification documentation based on OAS 3.0 for Sails APIs
MIT License
78 stars 33 forks source link

Swagger reads unrelated information #20

Closed Aristona closed 6 years ago

Aristona commented 6 years ago

Hi,

This is how my Swagger UI looks like.

image

My route:

image

My controller:

image

Why Swagger reads the property ID, and why does it read "body" object twice? Am I doing something wrong?

Ps. Token is coming from policies, but there is nothing related to ID in the policies.

theoomoregbee commented 6 years ago

hmmm what version of sailsjs are you using ?

Aristona commented 6 years ago

@theo4u 0.12.14. Tried it with 0.12.13 too, same.

theoomoregbee commented 6 years ago

will look into this soon

Aristona commented 6 years ago

Any news about it @theo4u ?

theoomoregbee commented 6 years ago

Oh, from observing the screenshots, the issue is with the Route.group seeing it as a separate controller I guess, if you can create a sample repo with this implementation, so I can pull and run through it @Aristona

Aristona commented 6 years ago

@theo4u I'll normalize the routes file and try. If I'm out of luck, I'll ask for your help

theoomoregbee commented 6 years ago

@Aristona ok np 👍

Aristona commented 6 years ago

@theo4u I cleared my routes.js file. It still reads the routes from somewhere. Does it read all the controllers and their methods or something? I double checked cache too. It generates a fresh json each time.

Edit: Seems like it reads controllers folder and tries to generate routes based on methods/controller names.

theoomoregbee commented 6 years ago

Yap, based on your controllers, the bootstrapped routes from sails are picked to generate the swagger, unless you don't want sails to generate auto routes for you, which you can turn off in config/blueprints and so on.

Is it still duplicating records ?

Aristona commented 6 years ago

@theo4u I turned it off, didn't help

theoomoregbee commented 6 years ago

turning it off, still generates default blueprints routes, weird behaviour here and also duplication of records

Would test for both errors again, if you can upload a sample repo with your configuration, so i can pull and test with

Aristona commented 6 years ago

@theo4u I'll do it next week probably. Will ping you when I'm done

theoomoregbee commented 6 years ago

the default model attribute was overriding the body defined in routes js. followed up here #29