Skip to content
Snippets Groups Projects
Commit 427e18ad authored by Neelesh Thakur's avatar Neelesh Thakur
Browse files

relax validation for internal schema fragments

parent 40bf76d9
Branches
Tags
1 merge request!143relax validation for internal schema fragments
Pipeline #34055 passed
......@@ -108,22 +108,26 @@ public class PropertiesProcessor {
private String getDefinitionIdentity(String definitionSubRef) {
String[] components = definitionSubRef.split(":");
if (components.length < 4) {
throw new AppException(HttpStatus.SC_CONFLICT, "Wrong definition format:" + definitionSubRef,
"Wrong definition format:" + definitionSubRef);
switch (components.length) {
case 1:
return components[0];
case 4:
return components[2];
}
return components[2];
throw new AppException(HttpStatus.SC_CONFLICT, "Wrong definition format:" + definitionSubRef,
"Wrong definition format:" + definitionSubRef);
}
private String getDefinitionColonVersion(String definitionSubRef) {
String[] components = definitionSubRef.split(":");
if (components.length < 4) {
throw new AppException(HttpStatus.SC_CONFLICT, "Wrong definition format:" + definitionSubRef,
"Wrong definition format:" + definitionSubRef);
switch (components.length) {
case 1:
return ":1.0.0";
case 4:
return ":" + components[3];
}
return ":" + components[3];
throw new AppException(HttpStatus.SC_CONFLICT, "Wrong definition format:" + definitionSubRef,
"Wrong definition format:" + definitionSubRef);
}
private Stream<Map<String, Object>> processOfItems(List<AllOfItem> allOf, List<AllOfItem> anyOf, List<AllOfItem> oneOf) {
......
......@@ -5,7 +5,7 @@ Purpose
-------
The purpose of this document is to describe schema conversion from the
Schema Service format to the Storage Service format.
Schema Service formats to the Storage Service format.
Storage Service schema has the following JSON format
----------------------------------------------------
......@@ -162,7 +162,7 @@ For instance
```json
opendes:wks:AbstractAnyCrsFeatureCollection:1.0.0
opendes:wks:anyJsonFeatureCollection
opendes:wks:anyJsonFeatureCollection:1.0.0
```
Ignored definition(-s) name(-s) are not included into Storage Service schema:
......@@ -318,14 +318,14 @@ For instance
```json
{
"definitions": {
"opendes:wks:wellboreData1:1.0.0": {
"wellboreData1": {
"properties": {
"prop1": {
"type": "string"
}
}
},
"opendes:wks:wellboreData2:1.0.0": {
"wellboreData2": {
"properties": {
"prop2": {
"type": "string"
......@@ -339,11 +339,11 @@ For instance
{
"anyOf": [
{
"$ref": "#/definitions/opendes:wks:wellboreData1:1.0.0"
"$ref": "#/definitions/wellboreData1"
} ],
"oneOf": [
{
"$ref": "#/definitions/opendes:wks:wellboreData2:1.0.0"
"$ref": "#/definitions/wellboreData2"
}
]
}
......
{
"definitions": {
"opendes:wks:wellboreData1:1.0.0": {
"wellboreData1": {
"properties": {
"prop1": {
"type": "string"
}
}
},
"opendes:wks:wellboreData2:1.0.0": {
"wellboreData2": {
"properties": {
"prop2": {
"type": "string"
}
}
},
"opendes:wks:wellboreData3:1.0.0": {
"wellboreData3": {
"properties": {
"prop3": {
"type": "string"
}
}
},
"opendes:wks:wellboreData4:1.0.0": {
"wellboreData4": {
"properties": {
"prop4": {
"type": "string"
......@@ -35,18 +35,18 @@
{
"allOf": [
{
"$ref": "#/definitions/opendes:wks:wellboreData1:1.0.0"
"$ref": "#/definitions/wellboreData1"
},
{
"$ref": "#/definitions/opendes:wks:wellboreData2:1.0.0"
"$ref": "#/definitions/wellboreData2"
}
]
},
{
"$ref": "#/definitions/opendes:wks:wellboreData3:1.0.0"
"$ref": "#/definitions/wellboreData3"
},
{
"$ref": "#/definitions/opendes:wks:wellboreData4:1.0.0"
"$ref": "#/definitions/wellboreData4"
}
]
}
......
{
"definitions": {
"opendes:wks:def1:1.0.0": {
"def1": {
"properties": {
"prop1": {
"type": "string"
......@@ -14,12 +14,12 @@
"FacilityName": {
"allOf": [
{
"$ref": "#/definitions/opendes:wks:def1:1.0.0"
"$ref": "#/definitions/def1"
},
{
"properties": {
"val" : {
"type": "string" }
"type": "string" }
}
}
]
......
{
"definitions": {
"opendes:wks:wellboreData1:1.0.0": {
"wellboreData1": {
"properties": {
"prop1": {
"type": "string"
}
}
},
"opendes:wks:wellboreData2:1.0.0": {
"wellboreData2": {
"allOf": [
{
"$ref": "#/definitions/opendes:wks:wellboreData1:1.0.0"
"$ref": "#/definitions/wellboreData1"
}
]
}
......@@ -20,7 +20,7 @@
"type": "object",
"properties": {
"Field": {
"$ref": "#/definitions/opendes:wks:wellboreData2:1.0.0"
"$ref": "#/definitions/wellboreData2"
}
}
}
......
{
"definitions": {
"opendes:wks:wellboreData1:1.0.0": {
"wellboreData1": {
"properties": {
"prop1": {
"type": "string"
}
}
},
"opendes:wks:wellboreData2:1.0.0": {
"wellboreData2": {
"properties": {
"prop2": {
"type": "string"
}
}
},
"opendes:wks:wellboreData3:1.0.0": {
"wellboreData3": {
"properties": {
"prop3": {
"type": "string"
}
}
},
"opendes:wks:wellboreData4:1.0.0": {
"wellboreData4": {
"properties": {
"prop4": {
"type": "string"
......@@ -35,19 +35,19 @@
{
"anyOf": [
{
"$ref": "#/definitions/opendes:wks:wellboreData1:1.0.0"
"$ref": "#/definitions/wellboreData1"
} ],
"oneOf": [
{
"$ref": "#/definitions/opendes:wks:wellboreData2:1.0.0"
"$ref": "#/definitions/wellboreData2"
}
]
},
{
"$ref": "#/definitions/opendes:wks:wellboreData3:1.0.0"
"$ref": "#/definitions/wellboreData3"
},
{
"$ref": "#/definitions/opendes:wks:wellboreData4:1.0.0"
"$ref": "#/definitions/wellboreData4"
}
]
}
......
{
"definitions": {
"opendes:wks:wellboreData1:1.0.0": {
"wellboreData1": {
"properties": {
"prop1": {
"type": "string"
}
}
},
"opendes:wks:wellboreData2:1.0.0": {
"wellboreData2": {
"anyOf": [
{
"$ref": "#/definitions/opendes:wks:wellboreData1:1.0.0"
"$ref": "#/definitions/wellboreData1"
}
]
}
......@@ -20,7 +20,7 @@
"type": "object",
"properties": {
"Field": {
"$ref": "#/definitions/opendes:wks:wellboreData2:1.0.0"
"$ref": "#/definitions/wellboreData2"
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment