Skip to content

Commit

Permalink
Add schema validation
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmaa committed Aug 29, 2024
1 parent 8d91fdc commit 718e766
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
44 changes: 44 additions & 0 deletions ext/data/schemas/default-options-overrides-schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"$id": "defaultOptionsOverride",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "Contains data for recommended default options overrides by language.",
"type": "object",
"patternProperties": {
"^.{2,}$": {
"type": "array",
"items": {
"type": "object",
"required": [
"path",
"value"
],
"properties": {
"path": {
"type": "string",
"minLength": 2
},
"value": {
"anyOf": [
{
"type": "string",
"minLength": 1
},
{
"type": "number"
},
{
"type": "boolean"
},
{
"type": "array"
},
{
"type": "object"
}
]
}
}
}
}
}
}
11 changes: 11 additions & 0 deletions test/data/json.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@
"typeFile": "types/test/json.d.ts",
"type": "AjvSchema"
},
{
"path": "ext/data/schemas/default-options-overrides-schema.json",
"typeFile": "types/test/json.d.ts",
"type": "AjvSchema"
},
{
"path": "test/data/translator-test-inputs.json",
"typeFile": "types/test/translator.d.ts",
Expand Down Expand Up @@ -192,6 +197,12 @@
"typeFile": "types/ext/dictionary-recommended.d.ts",
"type": "RecommendedDictionaries",
"schema": "ext/data/schemas/recommended-dictionaries-schema.json"
},
{
"path": "ext/data/default-options-overrides.json",
"typeFile": "types/ext/settings-controller.d.ts",
"type": "LanguageSettingOverrides",
"schema": "ext/data/schemas/default-options-overrides-schema.json"
}
]
}

0 comments on commit 718e766

Please sign in to comment.