Unnamed: 0
int64
0
305k
body
stringlengths
7
52.9k
name
stringlengths
1
185
65,000
void () { @Language("JSON") final String schema = """ { "patternProperties": { "^A" : { "type": "number" }, "B": { "type": "boolean" }, "C": { "enum": ["test", "em"] } } }"""; doTest(schema, """ Abezjana: 2 Auto: <warning descr="Schema validation: Incompatible types. Required: number. Actual: string.">no</warning> BAe:...
testPatternPropertiesHighlighting
65,001
void () { @Language("JSON") final String schema = """ { "type": "object", "additionalProperties": false, "patternProperties": { "p[0-9]": { "type": "string" }, "a[0-9]": { "enum": ["auto!"] } } }"""; doTest(schema, """ p1: <warning descr="Schema validation: Incompatible types. Required: string. Actual: integer.">1</war...
testPatternPropertiesFromIssue
65,002
void () { @Language("JSON") final String schema = """ { "properties": { "withPattern": { "pattern": "p[0-9]" } } }"""; final String correctText = "withPattern: p1"; final String wrongText = "withPattern: <warning descr=\"Schema validation: String violates the pattern: 'p[0-9]'\">wrong</warning>"; doTest(schema, correct...
testPatternForPropertyValue
65,003
void () { @Language("JSON") final String schema = """ { "properties": { "withPattern": { "pattern": "^\\\\d{4}\\\\-(0?[1-9]|1[012])\\\\-(0?[1-9]|[12][0-9]|3[01])$" } } }"""; @Language("yaml") final String correctText = "withPattern: 1234-11-11"; final String wrongText = "withPattern: <warning descr=\"Schema validation:...
testPatternWithSpecialEscapedSymbols
65,004
void () { doTest(rootObjectRedefinedSchema(), "<warning descr=\"Schema validation: Property 'a' is not allowed\">a: true</warning>\n" + "r1: allowed!"); }
testRootObjectRedefinedAdditionalPropertiesForbidden
65,005
void () { @Language("JSON") final String schema = """ { "properties": { "size": { "type": "object", "minProperties": 2, "maxProperties": 3, "properties": { "a": { "type": "boolean" } } } } }"""; doTest(schema, """ size:\s a: <warning descr="Schema validation: Incompatible types. Required: boolean. Actual: integer.">1</...
testNumberOfSameNamedPropertiesCorrectlyChecked
65,006
void () { @Language("JSON") final String schema = """ { "properties": { "array":{ "type": "array", "uniqueItems": true } } }"""; doTest(schema, """ array:\s - <warning descr="Schema validation: Item is not unique">1</warning> - <warning descr="Schema validation: Item is not unique">1</warning> - <warning descr="Schema ...
testManyDuplicatesInArray
65,007
void () { @Language("JSON") final String schema = """ { "properties": { "withPattern": { "pattern": "^[]$" } } }"""; final String text = """ withPattern: <warning descr="Schema validation: Cannot check the string by pattern because of an error: Unclosed character class near index 3 ^[]$ ^">(124)555-4216</warning>"""; d...
testPropertyValueAlsoHighlightedIfPatternIsInvalid
65,008
void () { @Language("JSON") final String schema = """ {"properties": { "not_type": { "not": { "type": "string" } } }}"""; doTest(schema, "not_type: <warning descr=\"Schema validation: Validates against 'not' schema\">wrong</warning>"); }
testNotSchema
65,009
void () { @Language("JSON") final String schema = """ {"properties": { "not_type": { "pattern": "^[a-z]*[0-5]*$", "not": { "pattern": "^[a-z]{1}[0-5]$" } } }}"""; doTest(schema, "not_type: va4"); doTest(schema, "not_type: <warning descr=\"Schema validation: Validates against 'not' schema\">a4</warning>"); doTest(schema...
testNotSchemaCombinedWithNormal
65,010
void () { @Language("JSON") final String schema = """ { "properties": { "withFormat": { "type": "string", "oneOf": [ { "format":"hostname" }, { "format": "ip4" } ] } } }"""; doTest(schema, "withFormat: localhost"); }
testDoNotMarkOneOfThatDiffersWithFormat
65,011
void () { @Language("JSON") final String schema = """ { "properties": { "withFormat": { "oneOf": [ { "format":"hostname" }, { "format": "ip4" } ] } } }"""; doTest(schema, "withFormat: localhost"); }
testAcceptSchemaWithoutType
65,012
void () { @Language("JSON") final String schema = """ { "items": [ { "type": "integer" }, { "$ref": "#/items/0" } ] }"""; doTest(schema, "- 1\n- 2"); doTest(schema, "- 1\n- <warning>foo</warning>"); }
testArrayItemReference
65,013
void () { @Language("JSON") final String schema = """ { "definitions": { "options": { "type": "array", "items": { "type": "number" } } }, "items": [ { "type": "boolean" }, { "type": "boolean" } ], "additionalItems": { "$ref": "#/definitions/options/items" } }"""; doTest(schema, "- true\n- true"); doTest(schema, "- true...
testValidateAdditionalItems
65,014
void () { @Language("JSON") String exclusiveMinSchema = "{\"properties\": {\"prop\": {\"exclusiveMinimum\": 3}}}"; doTest(exclusiveMinSchema, "prop: <warning>2</warning>"); doTest(exclusiveMinSchema, "prop: <warning>3</warning>"); doTest(exclusiveMinSchema, "prop: 4"); }
testExclusiveMinMaxV6_1
65,015
void () { @Language("JSON") String exclusiveMaxSchema = "{\"properties\": {\"prop\": {\"exclusiveMaximum\": 3}}}"; doTest(exclusiveMaxSchema, "prop: 2"); doTest(exclusiveMaxSchema, "prop: <warning>3</warning>"); doTest(exclusiveMaxSchema, "prop: <warning>4</warning>"); }
testExclusiveMinMaxV6_2
65,016
void () { doTest("{\"propertyNames\": {\"minLength\": 7}}", "{<warning>\"prop\"</warning>: 2}"); doTest("{\"properties\": {\"prop\": {\"propertyNames\": {\"minLength\": 7}}}}", "{\"prop\": {<warning>\"qq\"</warning>: 7}}"); }
testPropertyNamesV6
65,017
void () { @Language("JSON") String schema = "{\"properties\": {\"prop\": {\"type\": \"array\", \"contains\": {\"type\": \"number\"}}}}"; doTest(schema, "prop:\n <warning>- a\n - true</warning>"); doTest(schema, "prop:\n - a\n - true\n - 1"); }
testContainsV6
65,018
void () { @Language("JSON") String schema = "{\"properties\": {\"prop\": {\"type\": \"string\", \"const\": \"foo\"}}}"; doTest(schema, "prop: <warning>a</warning>"); doTest(schema, "prop: <warning>5</warning>"); doTest(schema, "prop: foo"); }
testConstV6
65,019
void () { @Language("JSON") String schema = """ { "if": { "properties": { "a": { "type": "string" } }, "required": ["a"] }, "then": { "properties": { "b": { "type": "number" } }, "required": ["b"] }, "else": { "properties": { "c": { "type": "boolean" } }, "required": ["c"] } }"""; doTest(schema, "c: <warning>5</warning...
testIfThenElseV7
65,020
void () { @Language("JSON") String schema = """ {"type":"object", "oneOf": [ { "properties": { "type": { "type": "string", "oneOf": [ { "pattern": "(good)" }, { "pattern": "(ok)" } ] } } }, { "properties": { "type": { "type": "string", "pattern": "^(fine)" }, "extra": { "type": "string" } }, "required": ["type", "extra...
testNestedOneOf
65,021
void () { @Language("JSON") String schema = """ { "myDefs": { "myArray": [ { "type": "number" }, { "type": "boolean" } ] }, "type": "array", "items": [ { "$ref": "#/myDefs/myArray/0" }, { "$ref": "#/myDefs/myArray/1" } ] }"""; doTest(schema, "- 1\n- <warning>2</warning>"); doTest(schema, "- <warning>a</warning>\n- <war...
testArrayRefs
65,022
void () { @Language("JSON") String schema = "{\"properties\": { \"platform\": { \"enum\": [\"x86\", \"x64\"] } }}"; doTest(schema, "platform:\n !!str x64"); doTest(schema, "platform:\n <warning>a x64</warning>"); }
testWithTags
65,023
void () { // no warning about missing required property - it should be discovered in referenced object // no warning about extra 'property' with name '<<' with additionalProperties=false doTest(SCHEMA_FOR_REFS, """ a: &a a: <warning descr="Schema validation: Incompatible types. Required: array. Actual: integer.">7</war...
testRefExtends
65,024
void () { // no warnings - &a references &b, which is an array - validation passes doTest(SCHEMA_FOR_REFS, """ x: &b - x - y a: &a a: *b bar: <<: *a b: 5"""); }
testRefRefValid
65,025
void () { doTest(SCHEMA_FOR_REFS, """ x: &b <warning descr="Schema validation: Incompatible types. Required: array. Actual: number.">7</warning> a: &a a: *b bar: <<: *a b: 5"""); }
testRefRefInvalid
65,026
void () { doTest(SCHEMA_FOR_REFS, """ x: &b 7 a: &a b: *b bar: <<: *a a: <warning descr="Schema validation: Incompatible types. Required: array. Actual: integer.">5</warning>"""); }
testRefRefScalarValid
65,027
void () { doTest(SCHEMA_FOR_REFS, """ bar: <<: &q a: <warning descr="Schema validation: Incompatible types. Required: array. Actual: integer.">5</warning> b: 5"""); }
testInlineRef
65,028
String (final String s) { return "{\"type\": \"object\", \"properties\": {\"prop\": " + s + "}}"; }
schema
65,029
String () { return """ { "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "$ref" : "#/definitions/root", "definitions": { "root" : { "type": "object", "additionalProperties": false, "properties": { "r1": { "type": "string" }, "r2": { "type": "string" } } } } } """; }
rootObjectRedefinedSchema
65,030
void () { doTest(""" { "properties": { "x": { "type": "number" } } }""", "x: 2.99792458e8"); }
testExpNumberNotation
65,031
void () { doTest(""" { "properties": { "x": { "type": "number" } } }""", "x:<warning descr=\"Schema validation: Incompatible types.\n Required: number. Actual: null.\"> </warning>"); }
testTreatEmptyValueAsNull_1
65,032
void () { doTest(""" { "properties": { "x": { "type": "null" } } }""", "x: "); }
testTreatEmptyValueAsNull_2
65,033
void () { doTest(""" { "type": "object", "properties": { "versionAsStringArray": { "type": "array", "items": { "type": "string" } } } }""", """ versionAsStringArray: -<warning descr="Schema validation: Incompatible types. Required: string. Actual: null."> </warning> <warning descr="Schema validation: Incompatible types...
testEmptyValueInArray
65,034
void () { doTest(""" { "type": "object", "properties": { "versionAsStringArray": { "type": "array" } }, "required": ["versionAsStringArray"] }""", "<warning descr=\"Schema validation: Missing required property 'versionAsStringArray'\"></warning>"); }
testEmptyFile
65,035
void () { doTest(""" { "type": "object", "properties": { "versionAsStringArray": { "type": "object", "properties": { "xxx": { "type": "number" }, "yyy": { "type": "string" }, "zzz": { "type": "number" } }, "required": ["xxx", "yyy", "zzz"] } }, "required": ["versionAsStringArray"] }""", """ versionAsStringArray: zzz: 0...
testEmptyValueBetweenProps
65,036
void () { doTest(""" {"properties": { "myPropertyXxx": { "deprecationMessage": "Baz", "description": "Foo bar" } }}""", "<weak_warning descr=\"Key 'myPropertyXxx' is deprecated: Baz\">myPropertyXxx</weak_warning>: a"); }
testDeprecation
65,037
void () { doTest(""" { "type": "object", "patternProperties": { ".*": { "type": "boolean" } }, "propertyNames": { "enum": ["a", "b"] } }""", "<warning>r</warning>: true"); }
testPropertyNameSchema
65,038
void () { doTest("{ \"type\": \"object\",\"required\": [\"test3\"]}", "<warning descr=\"Schema validation: Missing required property 'test3'\">test1: 123</warning>\ntest2: 456\n"); }
testReducedTopLevelRangeHighlighting
65,039
void () { doTest("{ \"type\": \"object\",\"required\": [\"test3\"]}", "<warning descr=\"Schema validation: Missing required property 'test3'\"></warning>"); }
testTopLevelRangeHighlighting
65,040
String () { return PathManagerEx.getCommunityHomePath() + "/plugins/yaml/testSrc/org/jetbrains/yaml/schema/data/highlighting"; }
getTestDataPath
65,041
String () { return "config.yml"; }
getTestFileName
65,042
InspectionProfileEntry () { return new YamlJsonSchemaHighlightingInspection(); }
getInspectionProfile
65,043
Predicate<VirtualFile> () { return file -> file.getFileType() instanceof LanguageFileType && ((LanguageFileType)file.getFileType()).getLanguage().isKindOf( YAMLLanguage.INSTANCE); }
getAvailabilityPredicate
65,044
void () { @Language("YAML") final String schema = """ properties: prop:\s "enum": - 1 - 2 - 3 - "18\""""; doTestYaml(schema, "prop: 1"); doTestYaml(schema, "prop: <warning>foo</warning>"); }
testEnum1
65,045
void () { @Language("YAML") final String schema = """ properties:\s prop: {} flop: {} required: - flop"""; doTestYaml(schema, "<warning>prop: 2</warning>"); doTestYaml(schema, "prop: 2\nflop: a"); doTestYaml(schema, "flop: a"); }
testMissingProp
65,046
void () { @Language("YAML") String schema = """ properties: prop: type: number multipleOf: 2"""; doTestYaml(schema, "prop: <warning descr=\"Schema validation: Is not multiple of 2\">3</warning>"); doTestYaml(schema, "prop: 4"); }
testNumberMultiple
65,047
void () { doTestYaml(""" properties: prop:\s type: number minimum: 0 maximum: 100 exclusiveMaximum: true""", "prop: 14"); }
testNumberMinMax
65,048
void () { @Language("YAML") final String schema = """ properties: prop: enum: - 1 - 2 - 3 - "18\""""; doTestYaml(schema, "prop: 18"); doTestYaml(schema, "prop: 2"); doTestYaml(schema, "prop: <warning descr=\"Schema validation: Value should be one of: 1, 2, 3, \\\"18\\\"\">6</warning>"); }
testEnum
65,049
void () { @Language("YAML") final String schema = """ properties: prop:\s type: string minLength: 2 maxLength: 3"""; doTestYaml(schema, "prop: <warning descr=\"Schema validation: String is shorter than 2\">s</warning>"); doTestYaml(schema, "prop: sh"); doTestYaml(schema, "prop: sho"); doTestYaml(schema, "prop: <warning...
testSimpleString
65,050
void () { @Language("YAML") final String schema = schema(""" { "type": "array", "items": { "type": "number", "minimum": 18 } }"""); doTestYaml(schema, "prop:\n - 101\n - 102"); doTestYaml(schema, "prop:\n - <warning descr=\"Schema validation: Less than the minimum 18\">16</warning>"); doTestYaml(schema, "prop:\n - <war...
testArray
65,051
void () { @Language("YAML") final String schema = """ type: array items: type: number minimum: 18 """; doTestYaml(schema, "- 101\n- 102"); }
testTopLevelArray
65,052
void () { @Language("YAML") final String schema = """ { "type": "array", "items": { "type": "object", "properties": {"a": {"type": "number"}} } }"""; doTestYaml(schema, "- a: <warning descr=\"Schema validation: Incompatible types.\n Required: number. Actual: boolean.\">true</warning>"); doTestYaml(schema, "- a: 18"); }
testTopLevelObjectArray
65,053
void () { @Language("YAML") final String schema = schema(""" { "type": "array", "items": [{ "type": "number", "minimum": 18 }, {"type" : "string"}] }"""); doTestYaml(schema, "prop:\n - 101\n - <warning descr=\"Schema validation: Incompatible types.\n Required: string. Actual: integer.\">102</warning>"); }
testArrayTuples1
65,054
void () { @Language("YAML") final String schema2 = schema(""" { "type": "array", "items": [{ "type": "number", "minimum": 18 }, {"type" : "string"}], "additionalItems": false}"""); doTestYaml(schema2, "prop:\n - 101\n - <warning descr=\"Schema validation: Incompatible types.\n Required: string. Actual: integer.\">102</...
testArrayTuples2
65,055
void () { @Language("YAML") final String schema = schema("{\"type\": \"array\", \"minItems\": 2, \"maxItems\": 3}"); doTestYaml(schema, "prop:\n <warning descr=\"Schema validation: Array is shorter than 2\">- 1</warning>"); doTestYaml(schema, "prop:\n - 1\n - 2"); doTestYaml(schema, "prop:\n <warning descr=\"Schema val...
testArrayLength
65,056
void () { @Language("YAML") final String schema = schema("{\"type\": \"array\", \"uniqueItems\": true}"); doTestYaml(schema, "prop:\n - 1\n - 2"); doTestYaml(schema, "prop:\n - <warning descr=\"Schema validation: Item is not unique\">1</warning>\n - 2\n - test\n - <warning descr=\"Schema validation: Item is not unique\...
testArrayUnique
65,057
void () { @Language("YAML") final String schema = """ { "title" : "Match anything", "description" : "This is a schema that matches anything.", "default" : "Default value" }"""; doTestYaml(schema, "anything: 1"); }
testMetadataIsOk
65,058
void () { @Language("YAML") final String schema = "{\"type\": \"object\", \"properties\": {\"a\": {}, \"b\": {}}, \"required\": [\"a\"]}"; doTestYaml(schema, "a: 11"); doTestYaml(schema, "a: 1\nb: true"); doTestYaml(schema, "<warning descr=\"Schema validation: Missing required property 'a'\">b: alarm</warning>"); }
testRequiredField
65,059
void () { @Language("YAML") final String schema = schema("{\"type\": \"object\", \"properties\": {\"a\": {}, \"b\": {}}, \"required\": [\"a\"]}"); doTestYaml(schema, "prop:\n a: 11"); doTestYaml(schema, "prop:\n a: 1\n b: true"); doTestYaml(schema, "prop:\n <warning descr=\"Schema validation: Missing required property ...
testInnerRequired
65,060
void () { @Language("YAML") final String schema = schema("{}"); doTestYaml(schema, "prop:\n q: true\n someStuff: 20"); }
testAdditionalPropertiesAllowed
65,061
void () { @Language("YAML") final String schema = "{\"type\": \"object\", \"properties\": {\"prop\": {}}, \"additionalProperties\": false}"; // not sure abt inner object doTestYaml(schema, "prop:\n q: true\n<warning descr=\"Schema validation: Property 'someStuff' is not allowed\">someStuff: 20</warning>"); }
testAdditionalPropertiesDisabled
65,062
void () { @Language("YAML") final String schema = "{\"type\": \"object\", \"properties\": {\"a\": {}}," + "\"additionalProperties\": {\"type\": \"number\"}}"; doTestYaml(schema, "a: moo\nb: 5\nc: <warning descr=\"Schema validation: Incompatible types.\n Required: number. Actual: string.\">foo</warning>"); }
testAdditionalPropertiesSchema
65,063
void () { @Language("YAML") final String schema = "{\"type\": \"object\", \"minProperties\": 2, \"maxProperties\": 3}"; doTestYaml(schema, "<warning descr=\"Schema validation: Number of properties is less than 2\">a: 3</warning>"); doTestYaml(schema, "a: 1\nb: 5"); doTestYaml(schema, """ <warning descr="Schema validati...
testMinMaxProperties
65,064
void () { final List<String> subSchemas = new ArrayList<>(); subSchemas.add("{\"type\": \"number\"}"); subSchemas.add("{\"type\": \"boolean\"}"); @Language("YAML") final String schema = schema("{\"oneOf\": [" + StringUtil.join(subSchemas, ", ") + "]}"); doTestYaml(schema, "prop: 5"); doTestYaml(schema, "prop: true"); d...
testOneOf
65,065
void () { final List<String> subSchemas = new ArrayList<>(); subSchemas.add("{\"type\": \"string\", \"enum\": [\"a\", \"b\"]}"); subSchemas.add("{\"type\": \"string\", \"enum\": [\"a\", \"c\"]}"); @Language("YAML") final String schema = schema("{\"oneOf\": [" + StringUtil.join(subSchemas, ", ") + "]}"); doTestYaml(sche...
testOneOfForTwoMatches
65,066
void () { final List<String> subSchemas = new ArrayList<>(); subSchemas.add(""" {"type": "string", "enum": [ "off", "warn", "error" ]}"""); subSchemas.add("{\"type\": \"integer\"}"); @Language("YAML") final String schema = schema("{\"oneOf\": [" + StringUtil.join(subSchemas, ", ") + "]}"); doTestYaml(schema, "prop: off...
testOneOfSelectError
65,067
void () { final List<String> subSchemas = new ArrayList<>(); subSchemas.add("{\"type\": \"string\", \"enum\": [\"a\", \"b\"]}"); subSchemas.add("{\"type\": \"string\", \"enum\": [\"a\", \"c\"]}"); @Language("YAML") final String schema = schema("{\"anyOf\": [" + StringUtil.join(subSchemas, ", ") + "]}"); doTestYaml(sche...
testAnyOf
65,068
void () { final List<String> subSchemas = new ArrayList<>(); subSchemas.add("{\"type\": \"integer\", \"multipleOf\": 2}"); subSchemas.add("{\"enum\": [1,2,3]}"); @Language("YAML") final String schema = schema("{\"allOf\": [" + StringUtil.join(subSchemas, ", ") + "]}"); doTestYaml(schema, "prop: <warning descr=\"Schema ...
testAllOf
65,069
void () { @Language("YAML") final String schema = schema("{\"type\": \"array\", \"items\": {\"type\": \"object\"," + "\"properties\": {" + "\"innerType\":{}, \"innerValue\":{}" + "}, \"additionalProperties\": false" + "}}"); doTestYaml(schema, "prop:\n- innerType: aaa\n <warning descr=\"Schema validation: Property 'ali...
testObjectInArray
65,070
void () { final String innerTypeSchema = "{\"properties\": {\"only\": {}}, \"additionalProperties\": false}"; @Language("YAML") final String schema = schema("{\"type\": \"array\", \"items\": {\"type\": \"object\"," + "\"properties\": {" + "\"innerType\":" + innerTypeSchema + "}, \"additionalProperties\": false" + "}}")...
testObjectDeeperInArray
65,071
void () { @Language("YAML") final String schema = "{\"properties\": {\"prop\": {\"type\": \"array\", \"items\": {\"enum\": [1,2,3]}}}}"; doTestYaml(schema, "prop:\n - 1\n - 3"); doTestYaml(schema, "prop:\n - <warning descr=\"Schema validation: Value should be one of: 1, 2, 3\">out</warning>"); }
testInnerObjectPropValueInArray
65,072
void () { @Language("YAML") final String schema = "{\"allOf\": [{\"type\": \"object\", \"properties\": {\"first\": {}}}," + " {\"properties\": {\"second\": {\"enum\": [33,44]}}}], \"additionalProperties\": false}"; // doTestYaml(schema, "first: true\nsecond: <warning descr=\"Schema validation: Value should be one of: [...
testAllOfProperties
65,073
void () { final String subSchema1 = "{\"enum\": [1,2,3,4,5]}"; final String subSchema2 = "{\"type\": \"array\", \"items\": {\"properties\": {\"kilo\": {}}, \"additionalProperties\": false}}"; @Language("YAML") final String schema = "{\"properties\": {\"prop\": {\"oneOf\": [" + subSchema1 + ", " + subSchema2 + "]}}}"; d...
testWithWaySelection
65,074
void () { @Language("YAML") final String schema = """ { "patternProperties": { "^A" : { "type": "number" }, "B": { "type": "boolean" }, "C": { "enum": ["test", "em"] } } }"""; doTestYaml(schema, """ Abezjana: 2 Auto: <warning descr="Schema validation: Incompatible types. Required: number. Actual: string.">no</warning> ...
testPatternPropertiesHighlighting
65,075
void () { @Language("YAML") final String schema = """ { "type": "object", "additionalProperties": false, "patternProperties": { "p[0-9]": { "type": "string" }, "a[0-9]": { "enum": ["auto!"] } } }"""; doTestYaml(schema, """ p1: <warning descr="Schema validation: Incompatible types. Required: string. Actual: integer.">1<...
testPatternPropertiesFromIssue
65,076
void () { @Language("YAML") final String schema = """ { "properties": { "withPattern": { "pattern": "p[0-9]" } } }"""; final String correctText = "withPattern: p1"; final String wrongText = "withPattern: <warning descr=\"Schema validation: String violates the pattern: 'p[0-9]'\">wrong</warning>"; doTestYaml(schema, cor...
testPatternForPropertyValue
65,077
void () { @Language("YAML") final String schema = """ { "properties": { "withPattern": { "pattern": "^\\\\d{4}\\\\-(0?[1-9]|1[012])\\\\-(0?[1-9]|[12][0-9]|3[01])$" } } }"""; @Language("yaml") final String correctText = "withPattern: 1234-11-11"; final String wrongText = "withPattern: <warning descr=\"Schema validation:...
testPatternWithSpecialEscapedSymbols
65,078
void () { doTestYaml(rootObjectRedefinedSchema(), "<warning descr=\"Schema validation: Property 'a' is not allowed\">a: true</warning>\n" + "r1: allowed!"); }
testRootObjectRedefinedAdditionalPropertiesForbidden
65,079
void () { @Language("YAML") final String schema = """ { "properties": { "size": { "type": "object", "minProperties": 2, "maxProperties": 3, "properties": { "a": { "type": "boolean" } } } } }"""; doTestYaml(schema, """ size:\s a: <warning descr="Schema validation: Incompatible types. Required: boolean. Actual: integer."...
testNumberOfSameNamedPropertiesCorrectlyChecked
65,080
void () { @Language("YAML") final String schema = """ { "properties": { "array":{ "type": "array", "uniqueItems": true } } }"""; doTestYaml(schema, """ array:\s - <warning descr="Schema validation: Item is not unique">1</warning> - <warning descr="Schema validation: Item is not unique">1</warning> - <warning descr="Sch...
testManyDuplicatesInArray
65,081
void () { @Language("YAML") final String schema = """ { "properties": { "withPattern": { "pattern": "^[]$" } } }"""; final String text = """ withPattern: <warning descr="Schema validation: Cannot check the string by pattern because of an error: Unclosed character class near index 3 ^[]$ ^">(124)555-4216</warning>"""; d...
testPropertyValueAlsoHighlightedIfPatternIsInvalid
65,082
void () { @Language("YAML") final String schema = """ {"properties": { "not_type": { "not": { "type": "string" } } }}"""; doTestYaml(schema, "not_type: <warning descr=\"Schema validation: Validates against 'not' schema\">wrong</warning>"); }
testNotSchema
65,083
void () { @Language("YAML") final String schema = """ {"properties": { "not_type": { "pattern": "^[a-z]*[0-5]*$", "not": { "pattern": "^[a-z]{1}[0-5]$" } } }}"""; doTestYaml(schema, "not_type: va4"); doTestYaml(schema, "not_type: <warning descr=\"Schema validation: Validates against 'not' schema\">a4</warning>"); doTes...
testNotSchemaCombinedWithNormal
65,084
void () { @Language("YAML") final String schema = """ { "properties": { "withFormat": { "type": "string", "oneOf": [ { "format":"hostname" }, { "format": "ip4" } ] } } }"""; doTestYaml(schema, "withFormat: localhost"); }
testDoNotMarkOneOfThatDiffersWithFormat
65,085
void () { @Language("YAML") final String schema = """ { "properties": { "withFormat": { "oneOf": [ { "format":"hostname" }, { "format": "ip4" } ] } } }"""; doTestYaml(schema, "withFormat: localhost"); }
testAcceptSchemaWithoutType
65,086
void () { @Language("YAML") final String schema = """ { "items": [ { "type": "integer" }, { "$ref": "#/items/0" } ] }"""; doTestYaml(schema, "- 1\n- 2"); doTestYaml(schema, "- 1\n- <warning>foo</warning>"); }
testArrayItemReference
65,087
void () { @Language("YAML") final String schema = """ { "definitions": { "options": { "type": "array", "items": { "type": "number" } } }, "items": [ { "type": "boolean" }, { "type": "boolean" } ], "additionalItems": { "$ref": "#/definitions/options/items" } }"""; doTestYaml(schema, "- true\n- true"); doTestYaml(schema,...
testValidateAdditionalItems
65,088
void () { @Language("YAML") String exclusiveMinSchema = "{\"properties\": {\"prop\": {\"exclusiveMinimum\": 3}}}"; doTestYaml(exclusiveMinSchema, "prop: <warning>2</warning>"); doTestYaml(exclusiveMinSchema, "prop: <warning>3</warning>"); doTestYaml(exclusiveMinSchema, "prop: 4"); }
testExclusiveMinMaxV6_1
65,089
void () { @Language("YAML") String exclusiveMaxSchema = "{\"properties\": {\"prop\": {\"exclusiveMaximum\": 3}}}"; doTestYaml(exclusiveMaxSchema, "prop: 2"); doTestYaml(exclusiveMaxSchema, "prop: <warning>3</warning>"); doTestYaml(exclusiveMaxSchema, "prop: <warning>4</warning>"); }
testExclusiveMinMaxV6_2
65,090
void () { @Language("YAML") String schema = "{\"properties\": {\"prop\": {\"type\": \"array\", \"contains\": {\"type\": \"number\"}}}}"; doTestYaml(schema, "prop:\n <warning>- a\n - true</warning>"); doTestYaml(schema, "prop:\n - a\n - true\n - 1"); }
testContainsV6
65,091
void () { @Language("YAML") String schema = "{\"properties\": {\"prop\": {\"type\": \"string\", \"const\": \"foo\"}}}"; doTestYaml(schema, "prop: <warning>a</warning>"); doTestYaml(schema, "prop: <warning>5</warning>"); doTestYaml(schema, "prop: foo"); }
testConstV6
65,092
void () { @Language("YAML") String schema = """ { "if": { "properties": { "a": { "type": "string" } }, "required": ["a"] }, "then": { "properties": { "b": { "type": "number" } }, "required": ["b"] }, "else": { "properties": { "c": { "type": "boolean" } }, "required": ["c"] } }"""; doTestYaml(schema, "c: <warning>5</war...
testIfThenElseV7
65,093
void () { @Language("YAML") String schema = """ {"type":"object", "oneOf": [ { "properties": { "type": { "type": "string", "oneOf": [ { "pattern": "(good)" }, { "pattern": "(ok)" } ] } } }, { "properties": { "type": { "type": "string", "pattern": "^(fine)" }, "extra": { "type": "string" } }, "required": ["type", "extra...
testNestedOneOf
65,094
void () { @Language("YAML") String schema = """ { "myDefs": { "myArray": [ { "type": "number" }, { "type": "boolean" } ] }, "type": "array", "items": [ { "$ref": "#/myDefs/myArray/0" }, { "$ref": "#/myDefs/myArray/1" } ] }"""; doTestYaml(schema, "- 1\n- <warning>2</warning>"); doTestYaml(schema, "- <warning>a</warning>...
testArrayRefs
65,095
void () { @Language("YAML") String schema = "{\"properties\": { \"platform\": { \"enum\": [\"x86\", \"x64\"] } }}"; doTestYaml(schema, "platform:\n !!str x64"); doTestYaml(schema, "platform:\n <warning>a x64</warning>"); }
testWithTags
65,096
void () { // no warning about missing required property - it should be discovered in referenced object // no warning about extra 'property' with name '<<' with additionalProperties=false doTestYaml(SCHEMA_FOR_REFS, """ a: &a a: <warning descr="Schema validation: Incompatible types. Required: array. Actual: integer.">7<...
testRefExtends
65,097
void () { // no warnings - &a references &b, which is an array - validation passes doTestYaml(SCHEMA_FOR_REFS, """ x: &b - x - y a: &a a: *b bar: <<: *a b: 5"""); }
testRefRefValid
65,098
void () { doTestYaml(SCHEMA_FOR_REFS, """ x: &b <warning descr="Schema validation: Incompatible types. Required: array. Actual: number.">7</warning> a: &a a: *b bar: <<: *a b: 5"""); }
testRefRefInvalid
65,099
void () { doTestYaml(SCHEMA_FOR_REFS, """ x: &b 7 a: &a b: *b bar: <<: *a a: <warning descr="Schema validation: Incompatible types. Required: array. Actual: integer.">5</warning>"""); }
testRefRefScalarValid