Closed srchulo closed 5 years ago
Also, what's interesting is that when the after_render
hooks is called after I believe the openapi render has rendered the JSON, the format passed in $format
to after_render
is 'html'.
Sorry, I hit the wrong button by mistake. (close/reopened)
I agree with you that it doesn't make any sense, so I need an example test/code to see what's really going on.
("Example test/code", means something small and manageable)
Going to close this issue, unless a small example is provided.
This may or may not be an issue with Mojolicious::Plugin::API, so if I'm misunderstanding, feel free to close this.
I added support for gzip using the after_render hook as shown here:
https://metacpan.org/pod/Mojolicious::Guides::Rendering#Post-processing-dynamic-content
When I do this, it breaks any responses that use the openapi renderer. I get an error like this:
[{"message":"Missing property.","path":"\/errors"}]
What's interesting about this, is I thought
after_render
would be called after openapi had already validated the output and rendered the JSON. I actually validated this by placing my own openapi renderer as shown here:https://metacpan.org/pod/Mojolicious::Plugin::OpenAPI#RENDERER
And printing out there and in my gzip hook, and the openapi renderer that returns the JSON does happen first. Maybe there's something else the OpenAPI plugin is doing that I'm not aware of? Validating after the JSON string has been generated?