Skip to content

Make it possible to include "unused" models in the generated swagger documentation, refs #90 #104

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

Merged
merged 1 commit into from
Apr 12, 2020

Conversation

volfpeter
Copy link

Changes:

  • Added a RESTX_INCLUDE_ALL_MODELS config option with a False default value.
  • Swagger.as_dict() now adds all existing models to the documentation if RESTX_INCLUDE_ALL_MODELS is set.
  • Added tests for RESTX_INCLUDE_ALL_MODELS.

@codecov
Copy link

codecov bot commented Mar 30, 2020

Codecov Report

Merging #104 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #104   +/-   ##
=======================================
  Coverage   96.91%   96.92%           
=======================================
  Files          19       19           
  Lines        2692     2696    +4     
=======================================
+ Hits         2609     2613    +4     
  Misses         83       83           
Impacted Files Coverage Δ
flask_restx/api.py 97.13% <100.00%> (+<0.01%) ⬆️
flask_restx/swagger.py 96.72% <100.00%> (+0.02%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 87267c5...475fcf7. Read the comment docs.

@ziirish
Copy link
Contributor

ziirish commented Mar 30, 2020

Hello,

Thank you for your contribution.
As is, it looks good enough for me. But I am planning to improve the documentation, especially the RESTX_ configuration options.

Would you mind waiting a bit for this change to come up, then updating your PR accordingly (that is adding a note in the documentation about this new option)?

I have no definitive ETA but I'd like to work on this within the end of the week.

@volfpeter
Copy link
Author

Well, if I'm being honest, I would prefer the PR to be merged to avoid possible conflicts with other commits. You could then open a separate issue for the documentation of RESTX_INCLUDE_ALL_MODELS and assign it to me or mention me in the description, I will write the docs for this option.

@volfpeter
Copy link
Author

@ziirish Hi! What do you think about the solution I proposed in my previous comment?

@volfpeter
Copy link
Author

@ziirish Hi, any update on this?

@ziirish ziirish merged commit 4193577 into python-restx:master Apr 12, 2020
@volfpeter
Copy link
Author

Thanks! As promised, I'll write the documentation for RESTX_INCLUDE_ALL_MODELS, just let me know when I can start.

@ziirish
Copy link
Contributor

ziirish commented Apr 12, 2020

Perfect, thanks!
I started to work on the doc here: #112
I added a note about the RESTX_INCLUDE_ALL_MODELS option, but I'm open to suggestions.

@volfpeter
Copy link
Author

Thanks. It's perfectly fine as it is in my opinion, but if you need any further contribution related to this feature, just let me know. If there's nothing else, then I think #90 can be closed.

@ziirish
Copy link
Contributor

ziirish commented Apr 12, 2020

Ok great. Thanks again for your contribution.

@volfpeter
Copy link
Author

Thanks for accepting the PR.

@am17torres
Copy link

am17torres commented May 12, 2020

Are you able to deploy a release with this change? Thanks!

Some context - We have an endpoint that returns a polymorphic response. The different response types are defined using api.model but they are not available for a reference in the schema definitions.

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

Successfully merging this pull request may close these issues.

3 participants