The mutually-exclusive url and identifier properties of License object are optional in specification and required in schema
See original GitHub issueIn 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):
Specification | Schema |
---|---|
|
|
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).
Issue Analytics
- State:
- Created a year ago
- Comments:11 (10 by maintainers)
Top GitHub Comments
There’s a brief explanation at the schema directory (version based), for example https://github.com/OAI/OpenAPI-Specification/tree/main/schemas/v3.1.
You only need to modify the YAML version, no need to update the date and the PR should be against the main branch.
🤦🏻♂️😅 Obviously “if A not B” also means “if B not A”. I really like the
dependentSchemas
option, let’s go for this one.