php-openapi
php-openapi copied to clipboard
validate() returns true with wrong top level elements
Hi, I tried to run validate like this:
$spec = cebe\openapi\Reader::readFromJson($jsonstring);
$spec->resolveReferences(new cebe\openapi\ReferenceContext($spec, "/"));
$spec->validate();
on a OpenAPI 3 schema that has, for example the property "AAAAAcomponents" instead of "components", and the call returns true. Is this correct? Thanks, Frank
it is possible to extend the OpenAPI description. So adding properties is generally allowed. Strictly following the spec would mean that you need to prefix additional properties with x-.
validation currently means to check if the existing elements are used correctly. It would be possible to add some kind of strict mode that would also complain about cases like yours.