From 8c23bcd7aafea11ecddff14804055856ec6d6e8e Mon Sep 17 00:00:00 2001 From: Victor Schappert Date: Wed, 11 Sep 2024 09:37:25 -0700 Subject: [PATCH] Fix missing validation bug in names rules --- .../common/names/names-invalid-language.yaml | 3 +++ .../common/names/names-invalid-variant.yaml | 22 +++++++++++++++++++ .../names-lexically-valid-language-tag.yaml | 2 ++ schema/defs.yaml | 2 +- 4 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 counterexamples/common/names/names-invalid-variant.yaml diff --git a/counterexamples/common/names/names-invalid-language.yaml b/counterexamples/common/names/names-invalid-language.yaml index 37237365..c615e06c 100644 --- a/counterexamples/common/names/names-invalid-language.yaml +++ b/counterexamples/common/names/names-invalid-language.yaml @@ -19,10 +19,13 @@ properties: rules: - language: etymology:wikidata value: Not allowed to have a colon + variant: common - language: etymology value: Too long + variant: alternate - language: pronunciation value: Too long + variant: official ext_expected_errors: - "additionalProperties 'zh_pinyin', 'en1', 'ja_rm' not allowed" - "[I#/properties/names/rules/0/language] [S#/$defs/propertyDefinitions/language/pattern] does not match pattern" diff --git a/counterexamples/common/names/names-invalid-variant.yaml b/counterexamples/common/names/names-invalid-variant.yaml new file mode 100644 index 00000000..2f320d99 --- /dev/null +++ b/counterexamples/common/names/names-invalid-variant.yaml @@ -0,0 +1,22 @@ +--- +id: names-invalid-variant +type: Feature +geometry: + type: LineString + coordinates: [[0, 0], [1, 1]] +properties: + theme: transportation + type: segment + version: 1 + subtype: road + class: primary + names: + primary: Bar + rules: + - value: I am missing the variant + - language: en-us + value: I have a fake/unsupported variant + variant: fake-variant + ext_expected_errors: + - "'/properties/names/rules/0': missing property 'variant'" + - "'/properties/names/rules/1/variant': value must be one of 'common', 'official', 'alternate', 'short'" diff --git a/examples/common/names/names-lexically-valid-language-tag.yaml b/examples/common/names/names-lexically-valid-language-tag.yaml index 5fa60d3b..a20a315a 100644 --- a/examples/common/names/names-lexically-valid-language-tag.yaml +++ b/examples/common/names/names-lexically-valid-language-tag.yaml @@ -21,5 +21,7 @@ properties: rules: - language: be-Latn value: Use this instead of be-tarask. + variant: common - language: ja-Latn value: Use this instead of ja_rm. + variant: alternate diff --git a/schema/defs.yaml b/schema/defs.yaml index fc5f17d0..27ec31fa 100644 --- a/schema/defs.yaml +++ b/schema/defs.yaml @@ -185,7 +185,7 @@ description: Common schema definitions shared by all themes 5. *("-" extension) nameRule: type: object - required: [value] + required: [variant, value] allOf: - { "$ref": "#/$defs/propertyContainers/geometricRangeScopeContainer" } - { "$ref": "#/$defs/propertyContainers/sideScopeContainer" }