Open VoltaireNoir opened 5 months ago
What is the task you'd like to do? You compile JSON Schema for Open API 3.0.3 (e.g. from the repo) and then validate the spec generated by utoipa
, right?
I got an impression though, that you pass an Open API spec to JSONSchema::compile
while Open API spec and JSON Schema are two separate things (even though Open API uses JSON Schema). In this case, the resulting validator will accept any inputs as there will be no JSON Schema keywords in the generated Open API spec.
The spec that I am using is generated by the
utoipa
crate. The spec version is3.0.3
. The entire spec compiles just fine withJSONSchema::compile
. However, there are no errors caused when I use thevalidate
method using invalid data.I tried compiling the specific schema of the type I'm trying to validate, but that returns
invalid reference
error (the schema contains internal references such as#/components/schemas/SchemaName
). I also tried using thewith_document
method and naming the document with#
but to no avail. I presume this was only meant to be used for external references.Is this version of the spec not supported? Or am I doing something wrong here? Any help would be greatly appreciated.