Swagger validation error for API documentation on "direct deployment"

When things doesn't work as they should.
Post Reply
Bastian
Posts: 7
Joined: Tue Dec 04, 2018 6:18 pm

Swagger validation error for API documentation on "direct deployment"

Post by Bastian » Mon Mar 11, 2019 9:34 am

Hi @all

I posted this as a side note in my other thread concerning the mayan_api client.
But the main problem seems to be, that the API documentation is not available in the "direct deployment" installation.
That's why the mayan_api cannot be initialized or connected.

So here's ascreenshots I've made on how the documentation link of swagger look like.
The link to reDoc opens up and then remains on Loading...

I've tried to open the documentations on the demo docker image on PWD there it was ok.

Where do I have to look or which files do I have to check or manually add to make the documentation and therefore the Python API calls work?

Thanks in advance.

As always, any help is greatly appreciated.

Bastian

ps: sorry the attached images seem to be messed up :)
Attachments
redoc_error1.png
redoc_error1.png (6.82 KiB) Viewed 46 times
swagger_error1.png
Swagger error message
swagger_error1.png (18.63 KiB) Viewed 46 times
swagger_error.png
swagger_error.png (18.63 KiB) Viewed 48 times
redoc_error.png
redoc_error.png (6.82 KiB) Viewed 48 times
Last edited by Bastian on Mon Mar 11, 2019 11:32 am, edited 1 time in total.

Bastian
Posts: 7
Joined: Tue Dec 04, 2018 6:18 pm

Re: No API documentation on direct deployment

Post by Bastian » Mon Mar 11, 2019 11:05 am

Hi again

I had a look at the log files and found an error coming up:

Error for swagger:
common.middleware.error_logging <955> [ERROR] "process_exception() line 17 Exception caught by request middleware; <WSGIRequest: GET '/swagger/?format=openapi'>, spec validation failed"
Traceback (most recent call last):
File "/opt/mayan-edms/lib/python2.7/site-packages/django/core/handlers/base.py", line 215, in _get_response
response = response.render()
File "/opt/mayan-edms/lib/python2.7/site-packages/django/template/response.py", line 107, in render
self.content = self.rendered_content
File "/opt/mayan-edms/lib/python2.7/site-packages/rest_framework/response.py", line 72, in rendered_content
ret = renderer.render(self.data, accepted_media_type, context)
File "/opt/mayan-edms/lib/python2.7/site-packages/drf_yasg/renderers.py", line 25, in render
return codec.encode(data)
File "/opt/mayan-edms/lib/python2.7/site-packages/drf_yasg/codecs.py", line 73, in encode
raise SwaggerValidationError("spec validation failed", errors, spec, self)
SwaggerValidationError: spec validation failed
Error for ReDoc:
common.middleware.error_logging <954> [ERROR] "process_exception() line 17 Exception caught by request middleware; <WSGIRequest: GET '/redoc/?format=openapi'>, spec validation failed"
Traceback (most recent call last):
File "/opt/mayan-edms/lib/python2.7/site-packages/django/core/handlers/base.py", line 215, in _get_response
response = response.render()
File "/opt/mayan-edms/lib/python2.7/site-packages/django/template/response.py", line 107, in render
self.content = self.rendered_content
File "/opt/mayan-edms/lib/python2.7/site-packages/rest_framework/response.py", line 72, in rendered_content
ret = renderer.render(self.data, accepted_media_type, context)
File "/opt/mayan-edms/lib/python2.7/site-packages/drf_yasg/renderers.py", line 25, in render
return codec.encode(data)
File "/opt/mayan-edms/lib/python2.7/site-packages/drf_yasg/codecs.py", line 73, in encode
raise SwaggerValidationError("spec validation failed", errors, spec, self)
SwaggerValidationError: spec validation failed

It seems to be an issue with an invalid validation schema from swagger_validator or the OpenAPI specs.

I've tried to replace the schema.json in:

Code: Select all

/opt/mayan-edms/lib/python2.7/site-packages/swagger_spec_validator/schemas/v2.0/

with the one from here:
https://github.com/OAI/OpenAPI-Specific ... hemas/v2.0


but it made no difference. The file on github is significantly bigger (524kb to original 40kb)

installed version of swagger_spec_validator is 2.1.0
... drf_yasg 1.5.0

Post Reply