Skip to content

The mutually-exclusive url and identifier properties of License object are optional in specification and required in schema #2975

@arno-di-loreto

Description

@arno-di-loreto

In the definition of the License object of OpenAPI 3.1: the url and identifier properties are not marked as REQUIRED, so optional, and are defined as mutually exclusive.

The schema of the License object does not match with the specification making url or identifier required using the following construction at the root of of the object definition:

"oneOf": [
  {"required": ["identifier"] },
  {"required": ["url"]}
]

If we compare both behaviors, that means the following (note that name is required):

SpecificationSchema
  • We can have
    • name alone
    • name and url
    • name and identifier
  • But we can't have
    • name, url and identifier
  • We can have
    • name alone
    • name and url
    • name and identifier
  • But we can't have
    • name alone
    • name, url and identifier
  • The following document which is valid according to the specification is considered invalid when using the schema with the validation script or directly using it with ajv:

    openapi: 3.1.0
    info:
      title: Dummy Bookshop
      version: '1.0'
      license:
        name: Apache 2.0
    paths: {}

    Before proposing a pull request to fix that issue, I would like to confirm that my interpretation of the specification is correct and to know if there are any recommendations to follow regarding when modifying the schema. Besides sticking to the JSON Schema version already used, there are maybe some features to not use to ensure compatibility? (I already found 4 different ways to say "url and identifier are optional and mutually exclusive", I'll put them in the discussion if fixing the schema is the solution).

    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