Skip to content

Add OAS3 parser configuration for strict reference validation on schema load #343

@makdad

Description

@makdad

Per the recent merge in openapi_parser to solve ota42y/openapi_parser#29 - it is now possible for the OAS3 schema parser to validate the schema's references on load.

In the future, we want this to be the default option on openapi_parser, which means there will be a behavior change in Committee as well (and I'm not sure if there is even a use case to allow broken references -- would love to hear input on this topic).

If we want to "upgrade" Committee users, we need to pass a parameter:

openapi = OpenAPIParser.parse_with_filepath(hash, schema_path)
:

openapi = OpenAPIParser.parse_with_filepath(hash, schema_path)

becomes

openapi = OpenAPIParser.parse_with_filepath(hash, schema_path, { strict_reference_validation: true })

We are not changing the interface of OpenAPI Parser, and prior to openapi_parser 1.0.0.beta1, this configuration did not exist -- so passing the config is a "NOOP" if the Committee user isn't using the latest beta -- so we don't have to worry about backward compatibility with the openapi_parser Gem versions.

Doing what I suggest above will break some Committee users who have unknown (or known) invalid references in their OAS3 files. So I think it may be better to offer this strict validation as a configuration on Committee as well (eventually defaulting to "strict", or at least leaving it to the user to decide).

OR, another thought would be to leave the openapi_parser Gem version specified by Committee at an older version -- and make the code change above (relying on the fact it will be ignored by older parsers) -- and then when we decide to make this mandatory on Committee, just bump the openapi_parser referenced Gem version.

Before I attempt a draft implementation on Committee, I'd like to collect feedback from the maintainers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions