Open roo-oliv opened 7 years ago
Thanks @mtronrd, I missed the Swagger::definition decorator because it was removed from README at: https://github.com/rochacbruno/flasgger/commit/c2b660fa7c745286d1222d55c34cd524a20c7919
I'm not sure why it was removed, but I think it was unintentionally removed when @rochacbruno was making some broad changes to the README file. I'll double check and then open a PR to re-add it to the README.
Currently, when you have endpoints for managing an entity, the entity's schema which will be used in these endpoints needs to be explicitly defined in the specs of one of these endpoints. For all the other endpoints you can just reference the schema with the
$ref: '#/definitions/Entity'
syntax. But it would be nicer to be able to just reference the schema in all the endpoints, avoiding to bloat the docstring of one of the endpoints with the entity's schema.The way I see to solve this is to enable providing definitions apart the endpoint specs. So you can declare the schemas independent from the endpoints.
I don't have a clear idea on how is the best way to do this.
A method to include a definition may be a good approach:
Another approach (non exclusive with the prior approach) would be allowing people to use the module's docstring to declare swagger specifications as well: