You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using JSON files to provide JSON blobs that get passed to internal methods but I want to make sure that when people extend this process, the JSON they provide really is correct according to the Swager definition. Could there be, or is there already, some way to use this library to do this, possibly by somehow Mocking up something with perhaps a request/response, URL and JSON blob inputs to provide enough for openapi-core to do its stuff?
Not sure if that's what being asked, but you definitely can validate JSON payloads from files (as opposed to validating the schema itself). All you need to do is to create simple implementations of the request / response protocols, openapi_core.protocols.Request and openapi_core.protocols.Response. Then you can pass your objects to the validate_request and validate_response methods.
Activity
p1c2u commentedon Jul 15, 2023
@papadeltasierra please check openapi-spec-validator project.
pawel-slowik commentedon May 28, 2024
Not sure if that's what being asked, but you definitely can validate JSON payloads from files (as opposed to validating the schema itself). All you need to do is to create simple implementations of the request / response protocols,
openapi_core.protocols.Requestandopenapi_core.protocols.Response. Then you can pass your objects to thevalidate_requestandvalidate_responsemethods.Example: