diff --git a/schemas/schema.json b/schemas/schema.json index aab3cff..8dc0b7b 100644 --- a/schemas/schema.json +++ b/schemas/schema.json @@ -9,7 +9,7 @@ "^COPY$": { "$ref": "#/definitions/TranslationWrapper" }, - "^(?!COPY|ACCESSIBILITY).*$": { + "^(?!COPY|ACCESSIBILITY)\\D.*$": { "$ref": "#/definitions/Node" } }, diff --git a/tests/actions/validate.test.js b/tests/actions/validate.test.js index e091229..010132d 100644 --- a/tests/actions/validate.test.js +++ b/tests/actions/validate.test.js @@ -50,3 +50,10 @@ test("validating fails when there's a collection requested that doesn't exist in ); expect(res.isError).toBe(true); }); + +test("validating fails when there's a key that starts with a digit", () => { + const res = loadYaml("tests/input/localicipe_invalid_key.yaml").flatMap(data => + validate(data, ["en"], undefined, ["COLLECTION"]) + ); + expect(res.isError).toBe(true); +}); diff --git a/tests/input/localicipe_invalid_key.yaml b/tests/input/localicipe_invalid_key.yaml new file mode 100644 index 0000000..aded0ac --- /dev/null +++ b/tests/input/localicipe_invalid_key.yaml @@ -0,0 +1,7 @@ +COLLECTION: + Checkout: + 1KeyStartingWithADigit: + Total: + COPY: + en: 'This is copy' + \ No newline at end of file