From 8b943cc97fab890085448122e7c13dd035d0e238 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Wed, 20 Dec 2023 00:47:15 -0500 Subject: JSON validation (#394) * Set up JSON testing * Add schema validation * Use parseJson * Finish types * Disambiguate ext/json-schema from node dependency with the same name * Add support for specifying the jsconfig file * Don't expose types * Update types * Use dictionary map type * Fix types * Fix AJV warnings * Move types * Move anb rename file * Move common mocks * Simplify types --- test/data/json.json | 174 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 174 insertions(+) create mode 100644 test/data/json.json (limited to 'test/data/json.json') diff --git a/test/data/json.json b/test/data/json.json new file mode 100644 index 00000000..6d806263 --- /dev/null +++ b/test/data/json.json @@ -0,0 +1,174 @@ +{ + "files": [ + {"path": "package.json", "ignore": true}, + {"path": "package-lock.json", "ignore": true}, + {"path": "jsconfig.json", "ignore": true}, + {"path": ".stylelintrc.json", "ignore": true}, + {"path": ".htmlvalidate.json", "ignore": true}, + {"path": ".eslintrc.json", "ignore": true}, + {"path": ".vscode/settings.json", "ignore": true}, + {"path": ".vscode/extensions.json", "ignore": true}, + {"path": "dev/jsconfig.json", "ignore": true}, + {"path": "ext/manifest.json", "ignore": true}, + {"path": "test/data/dictionaries/invalid-dictionary1/index.json", "ignore": true}, + {"path": "test/data/dictionaries/invalid-dictionary2/kanji_bank_1.json", "ignore": true}, + {"path": "test/data/dictionaries/invalid-dictionary2/index.json", "ignore": true}, + {"path": "test/data/dictionaries/invalid-dictionary3/kanji_meta_bank_1.json", "ignore": true}, + {"path": "test/data/dictionaries/invalid-dictionary3/index.json", "ignore": true}, + {"path": "test/data/dictionaries/invalid-dictionary4/tag_bank_1.json", "ignore": true}, + {"path": "test/data/dictionaries/invalid-dictionary4/index.json", "ignore": true}, + {"path": "test/data/dictionaries/invalid-dictionary5/term_bank_1.json", "ignore": true}, + {"path": "test/data/dictionaries/invalid-dictionary5/index.json", "ignore": true}, + {"path": "test/data/dictionaries/invalid-dictionary6/term_meta_bank_1.json", "ignore": true}, + {"path": "test/data/dictionaries/invalid-dictionary6/index.json", "ignore": true}, + {"path": "test/jsconfig.json", "ignore": true}, + + { + "path": "dev/data/manifest-variants.json", + "typeFile": "types/dev/manifest.d.ts", + "type": "ManifestConfig" + }, + { + "path": "ext/data/deinflect.json", + "typeFile": "types/ext/deinflector.d.ts", + "type": "ReasonsRaw" + }, + { + "path": "ext/data/pronunciation-style.json", + "typeFile": "types/ext/css-style-applier.d.ts", + "type": "RawStyleData" + }, + { + "path": "ext/data/structured-content-style.json", + "typeFile": "types/ext/css-style-applier.d.ts", + "type": "RawStyleData" + }, + { + "path": "ext/data/schemas/dictionary-index-schema.json", + "typeFile": "types/test/json.d.ts", + "type": "AjvSchema" + }, + { + "path": "ext/data/schemas/dictionary-kanji-bank-v1-schema.json", + "typeFile": "types/test/json.d.ts", + "type": "AjvSchema" + }, + { + "path": "ext/data/schemas/dictionary-kanji-bank-v3-schema.json", + "typeFile": "types/test/json.d.ts", + "type": "AjvSchema" + }, + { + "path": "ext/data/schemas/dictionary-kanji-meta-bank-v3-schema.json", + "typeFile": "types/test/json.d.ts", + "type": "AjvSchema" + }, + { + "path": "ext/data/schemas/dictionary-tag-bank-v3-schema.json", + "typeFile": "types/test/json.d.ts", + "type": "AjvSchema" + }, + { + "path": "ext/data/schemas/dictionary-term-bank-v1-schema.json", + "typeFile": "types/test/json.d.ts", + "type": "AjvSchema" + }, + { + "path": "ext/data/schemas/dictionary-term-bank-v3-schema.json", + "typeFile": "types/test/json.d.ts", + "type": "AjvSchema" + }, + { + "path": "ext/data/schemas/dictionary-term-meta-bank-v3-schema.json", + "typeFile": "types/test/json.d.ts", + "type": "AjvSchema" + }, + { + "path": "ext/data/schemas/custom-audio-list-schema.json", + "typeFile": "types/test/json.d.ts", + "type": "AjvSchema" + }, + { + "path": "ext/data/schemas/options-schema.json", + "typeFile": "types/test/json.d.ts", + "type": "AjvSchema" + }, + { + "path": "test/data/translator-test-inputs.json", + "typeFile": "types/test/translator.d.ts", + "type": "TranslatorTestInputs", + "jsconfig": "test" + }, + { + "path": "test/data/translator-test-results.json", + "typeFile": "types/test/translator.d.ts", + "type": "TranslatorTestResults", + "jsconfig": "test" + }, + { + "path": "test/data/translator-test-results-note-data1.json", + "typeFile": "types/test/translator.d.ts", + "type": "TranslatorTestNoteDataResults", + "jsconfig": "test" + }, + { + "path": "test/data/anki-note-builder-test-results.json", + "typeFile": "types/test/translator.d.ts", + "type": "AnkiNoteBuilderTestResults", + "jsconfig": "test" + }, + { + "path": "test/data/json.json", + "typeFile": "types/test/json.d.ts", + "type": "JsonInfo" + }, + { + "path": "test/data/dictionaries/valid-dictionary1/index.json", + "typeFile": "types/ext/dictionary-data.d.ts", + "type": "Index", + "schema": "ext/data/schemas/dictionary-index-schema.json" + }, + { + "path": "test/data/dictionaries/valid-dictionary1/kanji_bank_1.json", + "typeFile": "types/ext/dictionary-data.d.ts", + "type": "KanjiV3Array", + "schema": "ext/data/schemas/dictionary-kanji-bank-v3-schema.json" + }, + { + "path": "test/data/dictionaries/valid-dictionary1/kanji_meta_bank_1.json", + "typeFile": "types/ext/dictionary-data.d.ts", + "type": "KanjiMetaArray", + "schema": "ext/data/schemas/dictionary-kanji-meta-bank-v3-schema.json" + }, + { + "path": "test/data/dictionaries/valid-dictionary1/tag_bank_1.json", + "typeFile": "types/ext/dictionary-data.d.ts", + "type": "TagArray", + "schema": "ext/data/schemas/dictionary-tag-bank-v3-schema.json" + }, + { + "path": "test/data/dictionaries/valid-dictionary1/tag_bank_2.json", + "typeFile": "types/ext/dictionary-data.d.ts", + "type": "TagArray", + "schema": "ext/data/schemas/dictionary-tag-bank-v3-schema.json" + }, + { + "path": "test/data/dictionaries/valid-dictionary1/tag_bank_3.json", + "typeFile": "types/ext/dictionary-data.d.ts", + "type": "TagArray", + "schema": "ext/data/schemas/dictionary-tag-bank-v3-schema.json" + }, + { + "path": "test/data/dictionaries/valid-dictionary1/term_bank_1.json", + "typeFile": "types/ext/dictionary-data.d.ts", + "type": "TermV3Array", + "schema": "ext/data/schemas/dictionary-term-bank-v3-schema.json" + }, + { + "path": "test/data/dictionaries/valid-dictionary1/term_meta_bank_1.json", + "typeFile": "types/ext/dictionary-data.d.ts", + "type": "TermMetaArray", + "schema": "ext/data/schemas/dictionary-term-meta-bank-v3-schema.json" + } + ] +} \ No newline at end of file -- cgit v1.2.3