Skip to content

Commit

Permalink
14-schemas: Using oneOf rather than anyOf for titled enumerations
Browse files Browse the repository at this point in the history
- This is the recommendation from json-schema-org/json-schema-spec#57 (comment)
  • Loading branch information
jerstlouis committed Sep 24, 2024
1 parent cf37e02 commit ffb630a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions collections/clause_14_schemas.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,12 @@ The next example is the schema of a land cover collection.
"title" : "Land Cover",
"type" : "integer",
"x-ogc-propertySeq" : 1,
"anyOf": [
"oneOf": [
{ "const": 0 },
{ "const": 1, "title": "vegetation" },
{ "const": 2, "title": "bare soils" },
{ "const": 3, "title": "water" },
{ "const": 4, "title": "clouds" },
{ "const": 4, "title": "clouds" }
],
"x-ogc-nilValues": [
{ "const": 0, "title": "no data" }
Expand Down
2 changes: 1 addition & 1 deletion collections/recommendations/schemas/REC_properties.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
^|F |For string properties, "minLength", "maxLength", "enum" and/or "pattern" SHOULD be provided, where applicable.
^|G |For numeric properties, "multipleOf", "minimum", "exclusiveMinimum", "maximum", "exclusiveMaximum" SHOULD be provided, where applicable.
^|H |For integer properties that represent enumerated values without providing a description for each, "enum" SHOULD be provided.
^|I |For integer properties that represent enumerated values while providing a description for each, "anyOf" with a combination of "const" and "title" for each entry SHOULD be provided.
^|I |For integer properties that represent enumerated values while providing a description for each, "oneOf" with a combination of "const" and "title" for each entry SHOULD be provided.
^|J |For array properties, the property SHOULD consist of items that are strings or numbers.
^|K |Required properties SHOULD be included in "required".
^|L |The JSON Schema keywords SHOULD be constrained to those mentioned in this recommendation, requirement `/req/{req-class}/properties` and requirements in the _additional keywords_ section below.
Expand Down

0 comments on commit ffb630a

Please sign in to comment.