Skip to content

[Bug]: FlaskOpenAPIView no longer supports custom response validator #662

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
jtherrmann opened this issue Sep 7, 2023 · 3 comments · Fixed by #667
Closed

[Bug]: FlaskOpenAPIView no longer supports custom response validator #662

jtherrmann opened this issue Sep 7, 2023 · 3 comments · Fixed by #667
Labels
kind/bug Indicates an issue

Comments

@jtherrmann
Copy link

jtherrmann commented Sep 7, 2023

Actual Behavior

Previously, the FlaskOpenAPIView class allowed setting the self.response_validator attribute to a custom validator. This behavior was removed sometime after openapi-core v0.14.5. (This is a follow-up from #618 where this issue was discussed in the context of custom formatters.)

Expected Behavior

With openapi-core==0.14.5 installed, we currently use a custom response validator to effectively disable response validation, like this:

from openapi_core.validation.response.datatypes import ResponseValidationResult

class NonValidator:
    def __init__(self, spec):
        pass

    def validate(self, res):
        return ResponseValidationResult()

Then, in our sub-class of FlaskOpenAPIView, we set self.response_validator = NonValidator.

However, this no longer works with openapi-core==0.18.0. We hope to see this feature restored in a future release.

Alternatively, is there a way to simply disable response validation entirely?

Steps to Reproduce

See the example above.

OpenAPI Core Version

0.18.0

OpenAPI Core Integration

flask

Affected Area(s)

validation

References

#618

Anything else we need to know?

No response

Would you like to implement a fix?

None

@jtherrmann
Copy link
Author

Thanks for the fix!

@jtherrmann
Copy link
Author

@p1c2u Are there plans to release this fix to production within the near future?

@p1c2u
Copy link
Collaborator

p1c2u commented Oct 31, 2023

@jtherrmann pre-release version will be available soon, we will need to wait little bit longer with final version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Indicates an issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants