mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
WEB-23376 Stylelint: correct schema used for the completion and highlighting (all rules listed; only a few of them have type specification)
WEB-23373 Stylelint: correct name of the property used in the package.json + additional test for complex schema definition usage
This commit is contained in:
@@ -35,7 +35,7 @@ import java.util.Map;
|
||||
*/
|
||||
public class JsonSchemaFileIndex extends FileBasedIndexExtension<String, Integer> {
|
||||
public static final ID<String, Integer> PROPERTIES_INDEX = ID.create("json.schema.properties.index");
|
||||
public static final int VERSION = 7;
|
||||
public static final int VERSION = 8;
|
||||
private IntInlineKeyDescriptor myKeyDescriptor = new IntInlineKeyDescriptor();
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -9,6 +9,7 @@ import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
@@ -66,6 +67,27 @@ public class JsonSchemaReadTest {
|
||||
Assert.assertTrue(read.getDefinitions().get("common").getProperties().containsKey("id"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testArrayItemsSchema() throws Exception {
|
||||
final File file = new File(PlatformTestUtil.getCommunityPath(), "json/tests/testData/jsonSchema/arrayItemsSchema.json");
|
||||
Assert.assertTrue(file.exists());
|
||||
final JsonSchemaReader reader = new JsonSchemaReader(null);
|
||||
final JsonSchemaObject read = reader.read(new FileReader(file), null);
|
||||
final Map<String, JsonSchemaObject> properties = read.getProperties();
|
||||
Assert.assertEquals(1, properties.size());
|
||||
final JsonSchemaObject object = properties.get("color-hex-case");
|
||||
final List<JsonSchemaObject> oneOf = object.getOneOf();
|
||||
Assert.assertEquals(2, oneOf.size());
|
||||
final JsonSchemaObject second = oneOf.get(1);
|
||||
final List<JsonSchemaObject> list = second.getItemsSchemaList();
|
||||
Assert.assertEquals(2, list.size());
|
||||
final JsonSchemaObject firstItem = list.get(0);
|
||||
final List<Object> anEnum = firstItem.getEnum();
|
||||
Assert.assertEquals(2, anEnum.size());
|
||||
Assert.assertTrue(anEnum.contains("\"lower\""));
|
||||
Assert.assertTrue(anEnum.contains("\"upper\""));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadSchemaWithWrongRequired() throws Exception {
|
||||
testSchemaReadNotHung(new File(PlatformTestUtil.getCommunityPath(), "json/tests/testData/jsonSchema/WithWrongRequired.json"));
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"definitions": {
|
||||
"lowerUpper": {"type": "string", "enum": ["lower","upper"]},
|
||||
"secondaryOption": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"message": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
"color-hex-case": {
|
||||
"description": "Specify lowercase or uppercase for hex colors.",
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "#/definitions/lowerUpper"
|
||||
},
|
||||
{
|
||||
"type": "array",
|
||||
"items": [
|
||||
{
|
||||
"$ref": "#/definitions/lowerUpper"
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/secondaryOption"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user