Merge pull request #3404 from ryanpetrello/fix-missing-swagger-endpoints

generate Swagger schemas as if view permissions didn't matter

Reviewed-by: https://github.com/softwarefactory-project-zuul[bot]
This commit is contained in:
softwarefactory-project-zuul[bot] 2019-03-12 15:09:52 +00:00 committed by GitHub
commit 22c4b28917
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,6 +13,17 @@ from rest_framework.views import APIView
from rest_framework_swagger import renderers
class SuperUserSchemaGenerator(SchemaGenerator):
def has_view_permissions(self, path, method, view):
#
# Generate the Swagger schema as if you were a superuser and
# permissions didn't matter; this short-circuits the schema path
# discovery to include _all_ potential paths in the API.
#
return True
class AutoSchema(DRFAuthSchema):
def get_link(self, path, method, base_url):
@ -59,7 +70,7 @@ class SwaggerSchemaView(APIView):
]
def get(self, request):
generator = SchemaGenerator(
generator = SuperUserSchemaGenerator(
title='Ansible Tower API',
patterns=None,
urlconf=None