Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes:
#1853
#1855
https://github.com/digitalocean/go-netbox/issues/26
drf_yasg provides more complete swagger output, allowing for generation of usable clients. As explained in drf_yasg's README, the django rest framework is based on coreapi, which doesn't include response schemas. drf_yasg instead approaches the swagger with openapi, allowing it to generate full response schemas.
Some custom work was needed to accommodate Netbox's custom field serializers, and to provide
x-nullable
attributes where appropriate.x-nullable
is an extension to OpenAPI v2, but is understood by the golang swagger generator I was targeting. I have not tried it with other generators.This also replaces the api documentation at
/api/docs
with similar documentation, also based off of the swagger UI. There is alternative documentation at/api/redoc/
included only because it is by default part of drf_yasg. That could easily be removed if it isn't desired.One other note: I was not able to get
old_requirements.txt
to work as expected with more than a single line in it. It simply errors out when thepycrypto
is not installed, because of the previous upgrade.Based on what you've done with psycopg2, I've moved django-rest-swagger to the top of that file.