Skip to content

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

Closed
@jtherrmann

Description

@jtherrmann

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugIndicates an issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions