Skip to content

validate() returns true with wrong top level elements #84

Open

Description

@franksl

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

Activity

  1. cebe commented on Dec 14, 2020

    @cebe
    Owner

    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-.

  2. cebe commented on Dec 14, 2020

    @cebe
    Owner

    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.

  3. added this to the 1.9.0 milestone on May 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions