Skip to content

WIP: initial openapi schema generator implementation #669

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

Closed
wants to merge 19 commits into from

Conversation

n2ygk
Copy link
Contributor

@n2ygk n2ygk commented Jun 27, 2019

Fixes #604

Description of the Change

Extends DRF >= 3.10's generateschema to produce a jsonapi-formatted OAS schema document.

Checklist

  • PR only contains one change (considered splitting up PR)
  • unit-test added
  • documentation updated
  • CHANGELOG.md updated (only for user relevant changes)
  • author name in AUTHORS

This is currently conditionalized to test for DRF >=3.10 so none of the test cases are executed, even with drfmaster (since 3.10 is not yet released), but, if you comment out those tests then it should work with drfmaster. Still some build failures with obsolete py27, py34, django111, etc. which should go away when #664 is merged.

@n2ygk
Copy link
Contributor Author

n2ygk commented Jul 1, 2019

TODOs:

@sliverc
Copy link
Member

sliverc commented Jul 5, 2019

This is quite a lengthy PR so not sure when I will find time to look at it. But I assume you are still working on it?

As this is another optional feature we should fix #674 first to cleanly define optional deps needed by this feature.

@arielpontes
Copy link
Contributor

Any news about this? I see the only missing checks are:

  1. updating docs
  2. updating CHANGELOG.md

Anything I could perhaps help with?

@n2ygk
Copy link
Contributor Author

n2ygk commented Aug 7, 2019

Any news about this? I see the only missing checks are:

  1. updating docs
  2. updating CHANGELOG.md

Anything I could perhaps help with?

@arielpontes Thanks for the offer to help.

There's a bit more to do than that, including the TODOs referenced above and the need to do #674 first. Perhaps you can start on that? There's also an additional optional package which is django-oauth-toolkit (used in generateschema to add oauth securitySchemes and security objects for path methods) which would I think also need to get added to the optional packages.

This code is based on DRF 3.10 pre-release which has since had a couple of minor releases -- currently at 3.10.2 -- so there may be some additional changes needed. I wanted to wait until DRF 3.10 settled down a bit and hope to have some time in the next week or two to get back to this, so it would really help if you (or @sliverc) could knock out #674.

Thanks!

@codecov
Copy link

codecov bot commented Aug 8, 2019

Codecov Report

Merging #669 into master will decrease coverage by 2.72%.
The diff coverage is 76.25%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #669      +/-   ##
==========================================
- Coverage   95.96%   93.24%   -2.73%     
==========================================
  Files          54       58       +4     
  Lines        2728     3166     +438     
==========================================
+ Hits         2618     2952     +334     
- Misses        110      214     +104
Impacted Files Coverage Δ
...ork_json_api/management/commands/generateschema.py 0% <0%> (ø)
example/settings/dev.py 100% <100%> (ø) ⬆️
rest_framework_json_api/schemas/openapi.py 72.64% <72.64%> (ø)
example/tests/unit/test_filter_schema_params.py 75.86% <75.86%> (ø)
rest_framework_json_api/django_filters/backends.py 97.5% <80%> (-2.5%) ⬇️
example/tests/test_openapi.py 96.05% <96.05%> (ø)

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 7c6cceb...4204d92. Read the comment docs.

@n2ygk
Copy link
Contributor Author

n2ygk commented Aug 12, 2019

I'm closing this in lieu of a new PR that isn't all messed up with the various merges from master.

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.

Support DRF 3.10+ generateschema (OAS 3)
3 participants