diff --git a/indexer-core/src/main/java/org/opengroup/osdu/indexer/schema/converter/PropertiesProcessor.java b/indexer-core/src/main/java/org/opengroup/osdu/indexer/schema/converter/PropertiesProcessor.java index f58605545479e2b686959a43033fcd146e20b2f0..a0a71a3370fad6b291ca35b42497d241d50ecb0b 100644 --- a/indexer-core/src/main/java/org/opengroup/osdu/indexer/schema/converter/PropertiesProcessor.java +++ b/indexer-core/src/main/java/org/opengroup/osdu/indexer/schema/converter/PropertiesProcessor.java @@ -15,11 +15,11 @@ package org.opengroup.osdu.indexer.schema.converter; import org.apache.http.HttpStatus; -import org.opengroup.osdu.core.common.logging.JaxRsDpsLog; import org.opengroup.osdu.core.common.model.http.AppException; import org.opengroup.osdu.core.common.search.Preconditions; import org.opengroup.osdu.indexer.schema.converter.config.SchemaConverterConfig; import org.opengroup.osdu.indexer.schema.converter.config.SchemaConverterPropertiesConfig; +import org.opengroup.osdu.indexer.schema.converter.exeption.SchemaProcessingException; import org.opengroup.osdu.indexer.schema.converter.tags.AllOfItem; import org.opengroup.osdu.indexer.schema.converter.tags.Definition; import org.opengroup.osdu.indexer.schema.converter.tags.Definitions; @@ -31,7 +31,6 @@ import java.util.stream.Stream; public class PropertiesProcessor { - private JaxRsDpsLog log; private SchemaConverterConfig schemaConverterConfig; private static final String DEF_PREFIX = "#/definitions/"; @@ -42,12 +41,13 @@ public class PropertiesProcessor { private final String pathPrefix; private final String pathPrefixWithDot; - public PropertiesProcessor(Definitions definitions, JaxRsDpsLog log, SchemaConverterConfig schemaConverterConfig) { - this(definitions, null, log, schemaConverterConfig); + private final List<String> errors = new LinkedList<>(); + + public PropertiesProcessor(Definitions definitions, SchemaConverterConfig schemaConverterConfig) { + this(definitions, null, schemaConverterConfig); } - public PropertiesProcessor(Definitions definitions, String pathPrefix, JaxRsDpsLog log, SchemaConverterConfig schemaConverterConfig) { - this.log = log; + public PropertiesProcessor(Definitions definitions, String pathPrefix, SchemaConverterConfig schemaConverterConfig) { this.definitions = definitions; this.pathPrefix = pathPrefix; this.pathPrefixWithDot = Objects.isNull(pathPrefix) || pathPrefix.isEmpty() ? "" : pathPrefix + "."; @@ -55,55 +55,71 @@ public class PropertiesProcessor { } public Stream<Map<String, Object>> processItem(AllOfItem allOfItem) { - Preconditions.checkNotNull(allOfItem, "allOfItem cannot be null"); + try { + Preconditions.checkNotNull(allOfItem, "allOfItem cannot be null"); - Stream<Map<String, Object>> ofItems = processOfItems(allOfItem.getAllOf(), allOfItem.getAnyOf(), allOfItem.getOneOf()); + Stream<Map<String, Object>> ofItems = processOfItems(allOfItem.getAllOf(), allOfItem.getAnyOf(), allOfItem.getOneOf()); - if (Objects.nonNull(ofItems)) { - return ofItems; - } + if (Objects.nonNull(ofItems)) { + return ofItems; + } - String ref = allOfItem.getRef(); + String ref = allOfItem.getRef(); - return Objects.isNull(ref) ? - allOfItem.getProperties().entrySet().stream().flatMap(this::processPropertyEntry) : processRef(ref); + return Objects.isNull(ref) ? + allOfItem.getProperties().entrySet().stream().flatMap(this::processPropertyEntry) : processRef(ref); + } catch (RuntimeException exception) { + errors.add(exception.getMessage()); + return Stream.empty(); + } } public Stream<Map<String, Object>> processRef(String ref) { Preconditions.checkNotNull(ref, "reference cannot be null"); - if (!ref.contains(DEF_PREFIX)) { - log.warning("Unknown definition:" + ref); - return Stream.empty(); - } + try { + if (!ref.contains(DEF_PREFIX)) { + throw new SchemaProcessingException("Unknown definition format, no prefix:" + ref); + } - String definitionSubRef = ref.substring(DEF_PREFIX.length()); + String definitionSubRef = ref.substring(DEF_PREFIX.length()); - String definitionIdentity = getDefinitionIdentity(definitionSubRef); + String definitionIdentity = getDefinitionIdentity(definitionSubRef); - if (schemaConverterConfig.getSkippedDefinitions().contains(definitionIdentity)) { - return Stream.empty(); - } + if (schemaConverterConfig.getSkippedDefinitions().contains(definitionIdentity)) { + return Stream.empty(); + } - if (Objects.nonNull(schemaConverterConfig.getSpecialDefinitionsMap().get(definitionIdentity))) { - return storageSchemaEntry( - schemaConverterConfig.getSpecialDefinitionsMap().get(definitionIdentity) + getDefinitionColonVersion(definitionSubRef), - pathPrefix); - } + if (Objects.nonNull(schemaConverterConfig.getSpecialDefinitionsMap().get(definitionIdentity))) { + return storageSchemaEntry( + schemaConverterConfig.getSpecialDefinitionsMap().get(definitionIdentity) + getDefinitionColonVersion(definitionSubRef), + pathPrefix); + } - Definition definition = definitions.getDefinition(definitionSubRef); - Optional.ofNullable(definition).orElseThrow(() -> - new AppException(HttpStatus.SC_NOT_FOUND, "Failed to find definition:" + definitionSubRef, - "Unknown definition:" + definitionSubRef)); + Definition definition = definitions.getDefinition(definitionSubRef); + Optional.ofNullable(definition).orElseThrow(() -> + new SchemaProcessingException("Failed to find definition:" + definitionSubRef)); - Stream<Map<String, Object>> ofItems = - processOfItems(definition.getAllOf(), definition.getAnyOf(), definition.getOneOf()); + Stream<Map<String, Object>> ofItems = + processOfItems(definition.getAllOf(), definition.getAnyOf(), definition.getOneOf()); + + if (Objects.nonNull(ofItems)) { + return ofItems; + } - if (Objects.nonNull(ofItems)) { - return ofItems; + return processProperties(definition.getProperties()); + } catch (RuntimeException exception) { + errors.add(exception.getMessage()); + return Stream.empty(); } + } + + public Stream<Map<String, Object>> processProperties(Map<String, TypeProperty> properties) { + return properties.entrySet().stream().flatMap(this::processPropertyEntry); + } - return processProperties(definition.getProperties()); + public List<String> getErrors() { + return errors; } private String getDefinitionIdentity(String definitionSubRef) { @@ -148,46 +164,53 @@ public class PropertiesProcessor { return ofItems; } - public Stream<Map<String, Object>> processProperties(Map<String, TypeProperty> properties) { - return properties.entrySet().stream().flatMap(this::processPropertyEntry); - } - private Stream<Map<String, Object>> processPropertyEntry(Map.Entry<String, TypeProperty> entry) { Preconditions.checkNotNull(entry, "entry cannot be null"); - if ("object".equals(entry.getValue().getType()) - && Objects.isNull(entry.getValue().getItems()) - && Objects.isNull(entry.getValue().getRef()) - && Objects.isNull(entry.getValue().getProperties())) { - return Stream.empty(); - } + try { + if ("object".equals(entry.getValue().getType()) + && Objects.isNull(entry.getValue().getItems()) + && Objects.isNull(entry.getValue().getRef()) + && Objects.isNull(entry.getValue().getProperties())) { + return Stream.empty(); + } + + if ("array".equals(entry.getValue().getType())) { + if (schemaConverterConfig.getSupportedArrayTypes().contains(entry.getValue().getItems().getType())) { + return storageSchemaEntry("[]" + getTypeByDefinitionProperty(entry.getValue()), pathPrefixWithDot + entry.getKey()); + } - if ("array".equals(entry.getValue().getType())) { - if (schemaConverterConfig.getSupportedArrayTypes().contains(entry.getValue().getItems().getType())) { - return storageSchemaEntry("[]" + getTypeByDefinitionProperty(entry.getValue()), pathPrefixWithDot + entry.getKey()); + return Stream.empty(); } - return Stream.empty(); - } + Stream<Map<String, Object>> ofItems = processOfItems(entry); - Stream<Map<String, Object>> ofItems = processOfItems(entry); + if (Objects.nonNull(ofItems)) { + return ofItems; + } - if (Objects.nonNull(ofItems)) { - return ofItems; - } + if (Objects.nonNull(entry.getValue().getProperties())) { + PropertiesProcessor propertiesProcessor = new PropertiesProcessor(definitions, pathPrefixWithDot + entry.getKey() + , new SchemaConverterPropertiesConfig()); + Stream<Map<String, Object>> result = entry.getValue().getProperties().entrySet().stream().flatMap(propertiesProcessor::processPropertyEntry); + errors.addAll(propertiesProcessor.getErrors()); + return result; + } - if (Objects.nonNull(entry.getValue().getProperties())) { - PropertiesProcessor propertiesProcessor = new PropertiesProcessor(definitions, pathPrefixWithDot + entry.getKey() - , log, new SchemaConverterPropertiesConfig()); - return entry.getValue().getProperties().entrySet().stream().flatMap(propertiesProcessor::processPropertyEntry); - } + if (Objects.nonNull(entry.getValue().getRef())) { + PropertiesProcessor propertiesProcessor = new PropertiesProcessor(definitions + , pathPrefixWithDot + entry.getKey(), new SchemaConverterPropertiesConfig()); + Stream<Map<String, Object>> refResult = propertiesProcessor.processRef(entry.getValue().getRef()); + errors.addAll(propertiesProcessor.getErrors()); + return refResult; + } - if (Objects.nonNull(entry.getValue().getRef())) { - return new PropertiesProcessor(definitions, pathPrefixWithDot + entry.getKey(), log, new SchemaConverterPropertiesConfig()) - .processRef(entry.getValue().getRef()); + return storageSchemaEntry(getTypeByDefinitionProperty(entry.getValue()), pathPrefixWithDot + entry.getKey()); + } catch (RuntimeException ex) { + errors.add(ex.getMessage()); + return Stream.empty(); } - return storageSchemaEntry(getTypeByDefinitionProperty(entry.getValue()), pathPrefixWithDot + entry.getKey()); } private Stream<Map<String, Object>> processOfItems(Map.Entry<String, TypeProperty> entry) { @@ -195,33 +218,36 @@ public class PropertiesProcessor { if (Objects.nonNull(entry.getValue().getAllOf())) { PropertiesProcessor propertiesProcessor = new PropertiesProcessor(definitions, pathPrefixWithDot + entry.getKey() - , log, new SchemaConverterPropertiesConfig()); + , new SchemaConverterPropertiesConfig()); ofItems = entry.getValue().getAllOf().stream().flatMap(propertiesProcessor::processItem); + errors.addAll(propertiesProcessor.getErrors()); } if (Objects.nonNull(entry.getValue().getAnyOf())) { PropertiesProcessor propertiesProcessor = new PropertiesProcessor(definitions, pathPrefixWithDot + entry.getKey() - , log, new SchemaConverterPropertiesConfig()); + , new SchemaConverterPropertiesConfig()); ofItems = Stream.concat(Optional.ofNullable(ofItems).orElseGet(Stream::empty), entry.getValue().getAnyOf().stream().flatMap(propertiesProcessor::processItem)); + errors.addAll(propertiesProcessor.getErrors()); } if (Objects.nonNull(entry.getValue().getOneOf())) { PropertiesProcessor propertiesProcessor = new PropertiesProcessor(definitions, pathPrefixWithDot + entry.getKey() - , log, new SchemaConverterPropertiesConfig()); + , new SchemaConverterPropertiesConfig()); ofItems = Stream.concat(Optional.ofNullable(ofItems).orElseGet(Stream::empty), entry.getValue().getOneOf().stream().flatMap(propertiesProcessor::processItem)); + errors.addAll(propertiesProcessor.getErrors()); } return ofItems; } private Stream<Map<String, Object>> storageSchemaEntry(String kind, String path) { - Preconditions.checkNotNullOrEmpty(kind, "kind cannot be null or empty"); Preconditions.checkNotNullOrEmpty(path, "path cannot be null or empty"); + Preconditions.checkNotNullOrEmpty(kind, String.format("kind cannot be null or empty for path '%s'", path)); Map<String, Object> map = new HashMap<>(); map.put("kind", kind); diff --git a/indexer-core/src/main/java/org/opengroup/osdu/indexer/schema/converter/SchemaToStorageFormatImpl.java b/indexer-core/src/main/java/org/opengroup/osdu/indexer/schema/converter/SchemaToStorageFormatImpl.java index f613d9f9c77e433f62a333b4688ad47b8e67a245..2ed1506a4f646548c69f9009aa4f2bb931a9af2c 100644 --- a/indexer-core/src/main/java/org/opengroup/osdu/indexer/schema/converter/SchemaToStorageFormatImpl.java +++ b/indexer-core/src/main/java/org/opengroup/osdu/indexer/schema/converter/SchemaToStorageFormatImpl.java @@ -16,11 +16,10 @@ package org.opengroup.osdu.indexer.schema.converter; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; -import org.apache.http.HttpStatus; import org.opengroup.osdu.core.common.logging.JaxRsDpsLog; -import org.opengroup.osdu.core.common.model.http.AppException; import org.opengroup.osdu.core.common.search.Preconditions; import org.opengroup.osdu.indexer.schema.converter.config.SchemaConverterConfig; +import org.opengroup.osdu.indexer.schema.converter.exeption.SchemaProcessingException; import org.opengroup.osdu.indexer.schema.converter.interfaces.SchemaToStorageFormat; import org.opengroup.osdu.indexer.schema.converter.tags.PropertiesData; import org.opengroup.osdu.indexer.schema.converter.tags.SchemaRoot; @@ -37,7 +36,6 @@ import java.util.stream.Collectors; public class SchemaToStorageFormatImpl implements SchemaToStorageFormat { private ObjectMapper objectMapper; - private JaxRsDpsLog log; private SchemaConverterConfig schemaConverterConfig; @Inject @@ -45,7 +43,6 @@ public class SchemaToStorageFormatImpl implements SchemaToStorageFormat { Preconditions.checkNotNull(objectMapper, "objectMapper cannot be null"); this.objectMapper = objectMapper; - this.log = log; this.schemaConverterConfig = schemaConverterConfig; } @@ -68,7 +65,7 @@ public class SchemaToStorageFormatImpl implements SchemaToStorageFormat { try { return objectMapper.readValue(schemaServiceFormat, SchemaRoot.class); } catch (JsonProcessingException e) { - throw new AppException(HttpStatus.SC_BAD_REQUEST, "Loading shchem error", "Failed to load schema", e); + throw new SchemaProcessingException("Failed to parse the schema"); } } @@ -76,7 +73,7 @@ public class SchemaToStorageFormatImpl implements SchemaToStorageFormat { try { return objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(schemaServiceFormat); } catch (JsonProcessingException e) { - throw new AppException(HttpStatus.SC_UNPROCESSABLE_ENTITY, "Saving JSON error", "Failed to save a JSON file", e); + throw new SchemaProcessingException("Failed to save the JSON file"); } } @@ -84,43 +81,49 @@ public class SchemaToStorageFormatImpl implements SchemaToStorageFormat { Preconditions.checkNotNull(objectMapper, "schemaServiceSchema cannot be null"); Preconditions.checkNotNullOrEmpty(kind, "kind cannot be null or empty"); - PropertiesProcessor propertiesProcessor = new PropertiesProcessor(schemaServiceSchema.getDefinitions(), log, schemaConverterConfig); + PropertiesProcessor propertiesProcessor = new PropertiesProcessor(schemaServiceSchema.getDefinitions(), schemaConverterConfig); final List<Map<String, Object>> storageSchemaItems = new ArrayList<>(); - if (schemaServiceSchema.getProperties() != null) { - PropertiesData schemaData = schemaServiceSchema.getProperties().getData(); - if (!Objects.isNull(schemaData)) { - - if (schemaData.getAllOf() != null) { - storageSchemaItems.addAll(schemaServiceSchema.getProperties().getData().getAllOf().stream() - .flatMap(propertiesProcessor::processItem) - .collect(Collectors.toList())); - } - - if (schemaData.getAnyOf() != null) { - storageSchemaItems.addAll(schemaServiceSchema.getProperties().getData().getAnyOf().stream() - .flatMap(propertiesProcessor::processItem) - .collect(Collectors.toList())); - } - - if (schemaData.getOneOf() != null) { - storageSchemaItems.addAll(schemaServiceSchema.getProperties().getData().getOneOf().stream() - .flatMap(propertiesProcessor::processItem) - .collect(Collectors.toList())); - } - - if (schemaData.getRef() != null) { - storageSchemaItems.addAll(propertiesProcessor.processRef(schemaData.getRef()) - .collect(Collectors.toList())); - } - - if (schemaData.getProperties() != null) { - storageSchemaItems.addAll(propertiesProcessor.processProperties(schemaData.getProperties()) - .collect(Collectors.toList())); - } - } - } else { - log.warning("Schema doesn't have properties, kind:" + kind); + if (schemaServiceSchema.getProperties() == null) { + throw new SchemaProcessingException(String.format("Schema doesn't have data section, kind: %s", kind)); + } + + PropertiesData schemaData = schemaServiceSchema.getProperties().getData(); + if (Objects.isNull(schemaData)) { + throw new SchemaProcessingException(String.format("Schema doesn't have properties section, kind: %s", kind)); + } + + if (schemaData.getAllOf() != null) { + storageSchemaItems.addAll(schemaServiceSchema.getProperties().getData().getAllOf().stream() + .flatMap(propertiesProcessor::processItem) + .collect(Collectors.toList())); + } + + if (schemaData.getAnyOf() != null) { + storageSchemaItems.addAll(schemaServiceSchema.getProperties().getData().getAnyOf().stream() + .flatMap(propertiesProcessor::processItem) + .collect(Collectors.toList())); + } + + if (schemaData.getOneOf() != null) { + storageSchemaItems.addAll(schemaServiceSchema.getProperties().getData().getOneOf().stream() + .flatMap(propertiesProcessor::processItem) + .collect(Collectors.toList())); + } + + if (schemaData.getRef() != null) { + storageSchemaItems.addAll(propertiesProcessor.processRef(schemaData.getRef()) + .collect(Collectors.toList())); + } + + if (schemaData.getProperties() != null) { + storageSchemaItems.addAll(propertiesProcessor.processProperties(schemaData.getProperties()) + .collect(Collectors.toList())); + } + + if (!propertiesProcessor.getErrors().isEmpty()) { + throw new SchemaProcessingException(String.format("Errors occurred during parsing the schema, kind: %s | errors: %s" , + kind, String.join(",", propertiesProcessor.getErrors()))); } final Map<String, Object> result = new LinkedHashMap<>(); @@ -129,5 +132,4 @@ public class SchemaToStorageFormatImpl implements SchemaToStorageFormat { return result; } - } diff --git a/indexer-core/src/main/java/org/opengroup/osdu/indexer/schema/converter/exeption/SchemaProcessingException.java b/indexer-core/src/main/java/org/opengroup/osdu/indexer/schema/converter/exeption/SchemaProcessingException.java new file mode 100644 index 0000000000000000000000000000000000000000..df4dcf456795f394af448a84da121113eb9a6f9a --- /dev/null +++ b/indexer-core/src/main/java/org/opengroup/osdu/indexer/schema/converter/exeption/SchemaProcessingException.java @@ -0,0 +1,7 @@ +package org.opengroup.osdu.indexer.schema.converter.exeption; + +public class SchemaProcessingException extends RuntimeException { + public SchemaProcessingException(final String message) { + super(message); + } +} diff --git a/indexer-core/src/main/java/org/opengroup/osdu/indexer/service/impl/SchemaProviderImpl.java b/indexer-core/src/main/java/org/opengroup/osdu/indexer/service/SchemaProviderImpl.java similarity index 86% rename from indexer-core/src/main/java/org/opengroup/osdu/indexer/service/impl/SchemaProviderImpl.java rename to indexer-core/src/main/java/org/opengroup/osdu/indexer/service/SchemaProviderImpl.java index 2323aeecdf9218aa1fa6eef5610d96803100d17c..6f2bf52cca0a5addf8c3c59a297cb548cd9171c6 100644 --- a/indexer-core/src/main/java/org/opengroup/osdu/indexer/service/impl/SchemaProviderImpl.java +++ b/indexer-core/src/main/java/org/opengroup/osdu/indexer/service/SchemaProviderImpl.java @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -package org.opengroup.osdu.indexer.service.impl; +package org.opengroup.osdu.indexer.service; import com.google.api.client.http.HttpMethods; import org.apache.http.HttpStatus; @@ -22,9 +22,8 @@ import org.opengroup.osdu.core.common.logging.JaxRsDpsLog; import org.opengroup.osdu.core.common.model.http.HttpResponse; import org.opengroup.osdu.core.common.provider.interfaces.IRequestInfo; import org.opengroup.osdu.indexer.config.IndexerConfigurationProperties; +import org.opengroup.osdu.indexer.schema.converter.exeption.SchemaProcessingException; import org.opengroup.osdu.indexer.schema.converter.interfaces.SchemaToStorageFormat; -import org.opengroup.osdu.indexer.service.SchemaService; -import org.opengroup.osdu.indexer.service.StorageService; import org.springframework.stereotype.Component; import javax.inject.Inject; @@ -59,7 +58,17 @@ public class SchemaProviderImpl implements SchemaService { @Override public String getSchema(String kind) throws URISyntaxException, UnsupportedEncodingException { - String schemaServiceSchema = getFromSchemaService(kind); + String schemaServiceSchema; + + try { + schemaServiceSchema = getFromSchemaService(kind); + } catch (SchemaProcessingException ex) { + log.error(ex.getMessage(), ex); + return null; + } catch (RuntimeException ex) { + log.error(String.format("Failed to get the schema from the Schema service, kind: %s | message: %s", kind, ex.getMessage()), ex); + return null; + } return Objects.nonNull(schemaServiceSchema) ? schemaServiceSchema : getFromStorageService(kind); } @@ -98,5 +107,4 @@ public class SchemaProviderImpl implements SchemaService { return this.urlFetchService.sendRequest(request); } - } diff --git a/indexer-core/src/test/java/org/opengroup/osdu/indexer/schema/converter/PropertiesProcessorTest.java b/indexer-core/src/test/java/org/opengroup/osdu/indexer/schema/converter/PropertiesProcessorTest.java index 182bc58d33e4a1f1c491b805c6d1c1fe1dca9eed..f130fa139304cee3dbc12ebd8e7cafc985390ad8 100644 --- a/indexer-core/src/test/java/org/opengroup/osdu/indexer/schema/converter/PropertiesProcessorTest.java +++ b/indexer-core/src/test/java/org/opengroup/osdu/indexer/schema/converter/PropertiesProcessorTest.java @@ -17,7 +17,6 @@ package org.opengroup.osdu.indexer.schema.converter; import org.junit.Test; import org.mockito.Mockito; import org.opengroup.osdu.core.common.logging.JaxRsDpsLog; -import org.opengroup.osdu.core.common.model.http.AppException; import org.opengroup.osdu.indexer.schema.converter.config.SchemaConverterPropertiesConfig; import org.opengroup.osdu.indexer.schema.converter.tags.AllOfItem; import org.opengroup.osdu.indexer.schema.converter.tags.Definition; @@ -35,27 +34,29 @@ public class PropertiesProcessorTest { private static final String PATH = "given_path"; private static final String DEFINITIONS_PREFIX = "#/definitions/"; - @Test(expected = AppException.class) - public void should_fail_on_unknown_reference_definition() { - JaxRsDpsLog log = Mockito.mock(JaxRsDpsLog.class); + @Test + public void should_fail_on_bad_reference_definition() { + PropertiesProcessor propertiesProcessor = new PropertiesProcessor(Mockito.mock(Definitions.class), new SchemaConverterPropertiesConfig()); + propertiesProcessor.processRef(DEFINITIONS_PREFIX + "unknownDefinition"); + assertEquals(1, propertiesProcessor.getErrors().size()); + } - new PropertiesProcessor(Mockito.mock(Definitions.class), log, new SchemaConverterPropertiesConfig()) - .processRef(DEFINITIONS_PREFIX + "unknownDefinition"); + @Test + public void should_fail_on_wrong_definition_format() { + PropertiesProcessor propertiesProcessor = new PropertiesProcessor(Mockito.mock(Definitions.class), new SchemaConverterPropertiesConfig()); + propertiesProcessor.processRef("unknownDefinition"); + assertEquals(1, propertiesProcessor.getErrors().size()); } @Test public void should_not_process_special_reference() { - JaxRsDpsLog log = Mockito.mock(JaxRsDpsLog.class); - - assertFalse(new PropertiesProcessor(null, log, new SchemaConverterPropertiesConfig()) + assertFalse(new PropertiesProcessor(null, new SchemaConverterPropertiesConfig()) .processRef(DEFINITIONS_PREFIX + "a:b:anyCrsGeoJsonFeatureCollection:1.0.0").findAny().isPresent()); } @Test public void should_return_special_type() { - JaxRsDpsLog log = Mockito.mock(JaxRsDpsLog.class); - - String res = new PropertiesProcessor(null, PATH, log, new SchemaConverterPropertiesConfig()) + String res = new PropertiesProcessor(null, PATH, new SchemaConverterPropertiesConfig()) .processRef(DEFINITIONS_PREFIX + "a:b:core_dl_geopoint:1.0.0").map(Object::toString).reduce("", String::concat); assertEquals("{path=" + PATH + ", kind=core:dl:geopoint:1.0.0}", res); } @@ -79,7 +80,7 @@ public class PropertiesProcessorTest { String defName = "a:b:defName:1.0.0"; definitions.add(defName, definition); - String res = new PropertiesProcessor(definitions, PATH, log, new SchemaConverterPropertiesConfig()) + String res = new PropertiesProcessor(definitions, PATH, new SchemaConverterPropertiesConfig()) .processRef(DEFINITIONS_PREFIX + defName).map(Object::toString).reduce("", String::concat); assertEquals(res, "{path="+ PATH + "." + propertyName + ", kind=string}"); } @@ -97,7 +98,7 @@ public class PropertiesProcessorTest { properties.put(PATH, property); allOfItem.setProperties(properties); - String res = new PropertiesProcessor(Mockito.mock(Definitions.class), log, new SchemaConverterPropertiesConfig()) + String res = new PropertiesProcessor(Mockito.mock(Definitions.class), new SchemaConverterPropertiesConfig()) .processItem(allOfItem).map(Object::toString).reduce("", String::concat); assertEquals("{path=" + PATH + ", kind=int}", res); } diff --git a/indexer-core/src/test/java/org/opengroup/osdu/indexer/schema/converter/SchemaToStorageFormatImplTest.java b/indexer-core/src/test/java/org/opengroup/osdu/indexer/schema/converter/SchemaToStorageFormatImplTest.java index e9ad441db9e9dd44c18ec2b5b99b5c3791db5461..7947615ebcaac6ce5850a29d87fd4299fe6d2dfb 100644 --- a/indexer-core/src/test/java/org/opengroup/osdu/indexer/schema/converter/SchemaToStorageFormatImplTest.java +++ b/indexer-core/src/test/java/org/opengroup/osdu/indexer/schema/converter/SchemaToStorageFormatImplTest.java @@ -20,6 +20,7 @@ import org.junit.Test; import org.mockito.Mockito; import org.opengroup.osdu.core.common.logging.JaxRsDpsLog; import org.opengroup.osdu.indexer.schema.converter.config.SchemaConverterPropertiesConfig; +import org.opengroup.osdu.indexer.schema.converter.exeption.SchemaProcessingException; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder; @@ -54,6 +55,11 @@ public class SchemaToStorageFormatImplTest { testSingleFile("/converter/new-definitions-format/colons-sample.json", "osdu:osdu:Wellbore:1.0.0"); } + @Test(expected = SchemaProcessingException.class) + public void wrongDefinitions() { + testSingleFile("/converter/bad-schema/wrong-definitions-and-missed-type.json", KIND); + } + @Test public void firstSchemaPassed() { testSingleFile("/converter/basic/schema.json", "osdu:osdu:Wellbore:1.0.0"); diff --git a/indexer-core/src/test/java/org/opengroup/osdu/indexer/service/impl/SchemaProviderImplTest.java b/indexer-core/src/test/java/org/opengroup/osdu/indexer/service/SchemaProviderImplTest.java similarity index 97% rename from indexer-core/src/test/java/org/opengroup/osdu/indexer/service/impl/SchemaProviderImplTest.java rename to indexer-core/src/test/java/org/opengroup/osdu/indexer/service/SchemaProviderImplTest.java index 870f2b76c7178ff6430521f3b90ebf2d39c16d55..9e6da1a355f2057eec76feaaa87ad47451a7ae52 100644 --- a/indexer-core/src/test/java/org/opengroup/osdu/indexer/service/impl/SchemaProviderImplTest.java +++ b/indexer-core/src/test/java/org/opengroup/osdu/indexer/service/SchemaProviderImplTest.java @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License.package org.opengroup.osdu.indexer.service.impl; -package org.opengroup.osdu.indexer.service.impl; +package org.opengroup.osdu.indexer.service; import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; @@ -70,7 +70,7 @@ public class SchemaProviderImplTest { org.opengroup.osdu.core.common.model.http.HttpResponse httpResponse = mock(org.opengroup.osdu.core.common.model.http.HttpResponse.class); when(httpResponse.getResponseCode()).thenReturn(HttpStatus.SC_OK); - when(httpResponse.getBody()).thenReturn("{}"); + when(httpResponse.getBody()).thenReturn("{ \"properties\" : { \"data\": {} } }"); when(urlFetchService.sendRequest(any())).thenReturn(httpResponse); String schema = sut.getSchema("fake"); @@ -140,7 +140,7 @@ public class SchemaProviderImplTest { String kind = "tenant:test:test:1.0.0"; SchemaProviderImpl schemaService = Mockito.mock(SchemaProviderImpl.class); - PowerMockito.when(schemaService.getSchema(any())).thenCallRealMethod(); + when(schemaService.getSchema(any())).thenCallRealMethod(); InOrder inOrder = inOrder(schemaService); diff --git a/indexer-core/src/test/resources/converter/R3-json-schema/Generated/work-product-component/WellLog.1.0.0.json b/indexer-core/src/test/resources/converter/R3-json-schema/Generated/work-product-component/WellLog.1.0.0.json index a7486367e98cae1ca66612cf7083a4ed872faa90..b2d6ce28ef2525fe813e86d2a2272495c2a380cb 100644 --- a/indexer-core/src/test/resources/converter/R3-json-schema/Generated/work-product-component/WellLog.1.0.0.json +++ b/indexer-core/src/test/resources/converter/R3-json-schema/Generated/work-product-component/WellLog.1.0.0.json @@ -113,12 +113,6 @@ }, "data": { "allOf": [ - { - "$ref": "../abstract/AbstractWPCGroupType.1.0.0.json" - }, - { - "$ref": "../abstract/AbstractWorkProductComponent.1.0.0.json" - }, { "type": "object", "properties": { diff --git a/indexer-core/src/test/resources/converter/R3-json-schema/Generated/work-product/WorkProduct.1.0.0.json b/indexer-core/src/test/resources/converter/R3-json-schema/Generated/work-product/WorkProduct.1.0.0.json index bc1795ac985b92a955fe9bd75c8e6c09823d3759..2a098b7fca37874dd9df69837573774d90da1936 100644 --- a/indexer-core/src/test/resources/converter/R3-json-schema/Generated/work-product/WorkProduct.1.0.0.json +++ b/indexer-core/src/test/resources/converter/R3-json-schema/Generated/work-product/WorkProduct.1.0.0.json @@ -152,14 +152,6 @@ "type": "string" } }, - "SpatialPoint": { - "description": "A centroid point that reflects the locale of the content of the work product (location of the subject matter).", - "$ref": "../abstract/AbstractSpatialLocation.1.0.0.json" - }, - "SpatialArea": { - "description": "A polygon boundary that reflects the locale of the content of the work product (location of the subject matter).", - "$ref": "../abstract/AbstractSpatialLocation.1.0.0.json" - }, "SubmitterName": { "type": "string", "description": "Name of the person that first submitted the work product package to OSDU." diff --git a/indexer-core/src/test/resources/converter/bad-schema/wrong-definitions-and-missed-type.json b/indexer-core/src/test/resources/converter/bad-schema/wrong-definitions-and-missed-type.json new file mode 100644 index 0000000000000000000000000000000000000000..e321224b08c4322e3d7f14929a29fbd2d7501535 --- /dev/null +++ b/indexer-core/src/test/resources/converter/bad-schema/wrong-definitions-and-missed-type.json @@ -0,0 +1,1912 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "Wellbore", + "description": "A hole in the ground extending from a point at the earth's surface to the maximum point of penetration.", + "type": "object", + "properties": { + "id": { + "description": "Previously called ResourceID or SRN which identifies this OSDU resource object without version.", + "title": "Entity ID", + "type": "string", + "pattern": "^srn:<namespace>:master-data\\/Wellbore:[^:]+$", + "example": "srn:<namespace>:master-data/Wellbore:2adac27b-5d84-5bcd-89f2-93ee709c06d9" + }, + "kind": { + "description": "The schema identification for the OSDU resource object following the pattern <Namespace>:<Source>:<Type>:<VersionMajor>.<VersionMinor>.<VersionPatch>. The versioning scheme follows the semantic versioning, https://semver.org/.", + "title": "Entity Kind", + "type": "string", + "pattern": "^[A-Za-z0-9-_]+:[A-Za-z0-9-_]+:[A-Za-z0-9-_]+:[0-9]+.[0-9]+.[0-9]+$", + "example": "namespace:osdu:Wellbore:2.7.112" + }, + "groupType": { + "description": "The OSDU group-type assigned to this resource object.", + "title": "Group Type", + "const": "master-data" + }, + "version": { + "description": "The version number of this OSDU resource; set by the framework.", + "title": "Version Number", + "type": "integer", + "format": "int64", + "example": 1562066009929332 + }, + "resourceSecurityClassification": { + "description": "Classifies the security level of the resource.", + "title": "Resource Security Classification", + "type": "string", + "pattern": "^srn:<namespace>:reference-data\\/ResourceSecurityClassification:[^:]+:[0-9]*$" + }, + "ancestry": { + "description": "The links to data, which constitute the inputs.", + "title": "Ancestry", + "$ref": "#/definitions/opendes:wks:AbstractLegalParentList:1.0.0" + }, + "meta": { + "description": "The Frame of Reference meta data section linking the named properties to self-contained definitions.", + "title": "Frame of Reference Meta Data", + "type": "array", + "items": { + "$ref": "#/definitions/opendes:wks:AbstractMetaItem:1.0.0" + } + }, + "source": { + "description": "The entity that produced the record, or from which it is received; could be an organization, agency, system, internal team, or individual. For informational purposes only, the list of sources is not governed.", + "title": "Data Source", + "type": "string" + }, + "existenceKind": { + "description": "Where does this data resource sit in the cradle-to-grave span of its existence?", + "title": "Existence Kind", + "type": "string", + "pattern": "^srn:<namespace>:reference-data\\/ExistenceKind:[^:]+:[0-9]*$" + }, + "data": { + "allOf": [ + { + "$ref": "#/definitions/AbstractFacility:1.0.0" + }, + { + "$ref": "#/definitions/wrong:AbstractFacility:1.0.0" + }, + { + "type": "object", + "properties": { + "WellID": { + + } + + } + }, + { + "type": "object", + "properties": { + "ExtensionProperties": { + "type": "object", + "properties": {} + } + } + } + ] + } + }, + "required": [ + "kind", + "acl", + "groupType", + "legal" + ], + "additionalProperties": false, + "definitions": { + "opendes:wks:AbstractAccessControlList:1.0.0": { + "title": "Access Control List", + "description": "The access control tags associated with this entity. This structure is included by the SystemProperties \"acl\", which is part of all OSDU records. Not extensible.", + "type": "object", + "properties": { + "owners": { + "title": "List of Owners", + "description": "The list of owners of this data record formatted as an email (core.common.model.storage.validation.ValidationDoc.EMAIL_REGEX).", + "type": "array", + "items": { + "type": "string", + "pattern": "^[a-zA-Z0-9_+&*-]+(?:\\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,7}$" + } + }, + "viewers": { + "title": "List of Viewers", + "description": "The list of viewers to which this data record is accessible/visible/discoverable formatted as an email (core.common.model.storage.validation.ValidationDoc.EMAIL_REGEX).", + "type": "array", + "items": { + "type": "string", + "pattern": "^[a-zA-Z0-9_+&*-]+(?:\\.[a-zA-Z0-9_+&*-]+)*@(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,7}$" + } + } + }, + "required": [ + "owners", + "viewers" + ], + "additionalProperties": false + }, + "opendes:wks:AbstractLegalTags:1.0.0": { + "title": "Legal Meta Data", + "description": "Legal meta data like legal tags, relevant other countries, legal status. This structure is included by the SystemProperties \"legal\", which is part of all OSDU records. Not extensible.", + "type": "object", + "properties": { + "legaltags": { + "title": "Legal Tags", + "description": "The list of legal tags, which resolve to legal properties (like country of origin, export classification code, etc.) and rules with the help of the Compliance Service.", + "type": "array", + "items": { + "type": "string" + } + }, + "otherRelevantDataCountries": { + "title": "Other Relevant Data Countries", + "description": "The list of other relevant data countries as an array of two-letter country codes, see https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2.", + "type": "array", + "items": { + "type": "string", + "pattern": "^[A-Z]{2}$" + } + }, + "status": { + "title": "Legal Status", + "description": "The legal status. Set by the system after evaluation against the compliance rules associated with the \"legaltags\" using the Compliance Service.", + "type": "string", + "pattern": "^srn:<namespace>:reference-data\\/LegalStatus:[^:]+:[0-9]*$" + } + }, + "required": [ + "legaltags", + "otherRelevantDataCountries" + ], + "additionalProperties": false + }, + "opendes:wks:AbstractLegalParentList:1.0.0": { + "title": "Parent List", + "description": "A list of entity IDs in the data ecosystem, which act as legal parents to the current entity. This structure is included by the SystemProperties \"ancestry\", which is part of all OSDU records. Not extensible.", + "type": "object", + "properties": { + "parents": { + "description": "An array of none, one or many entity references in the data ecosystem, which identify the source of data in the legal sense. Example: the 'parents' will be queried when e.g. the subscription of source data services is terminated; access to the derivatives is also terminated.", + "items": { + "type": "string" + }, + "example": [], + "title": "Parents", + "type": "array" + } + }, + "additionalProperties": false + }, + "opendes:wks:AbstractMetaItem:1.0.0": { + "title": "Frame of Reference Meta Data Item", + "description": "A meta data item, which allows the association of named properties or property values to a Unit/Measurement/CRS/Azimuth/Time context.", + "oneOf": [ + { + "title": "FrameOfReferenceUOM", + "type": "object", + "properties": { + "kind": { + "title": "UOM Reference Kind", + "description": "The kind of reference, 'Unit' for FrameOfReferenceUOM.", + "const": "Unit" + }, + "name": { + "title": "UOM Unit Symbol", + "description": "The unit symbol or name of the unit.", + "type": "string", + "example": "ft[US]" + }, + "persistableReference": { + "title": "UOM Persistable Reference", + "description": "The self-contained, persistable reference string uniquely identifying the Unit.", + "type": "string", + "example": "{\"abcd\":{\"a\":0.0,\"b\":1200.0,\"c\":3937.0,\"d\":0.0},\"symbol\":\"ft[US]\",\"baseMeasurement\":{\"ancestry\":\"L\",\"type\":\"UM\"},\"type\":\"UAD\"}" + }, + "unitOfMeasureID": { + "description": "SRN to unit of measure reference.", + "type": "string", + "pattern": "^srn:<namespace>:reference-data\\/UnitOfMeasure:[^:]+:[0-9]*$", + "example": "srn:<namespace>:reference-data/UnitOfMeasure:Energistics_UoM_ftUS:" + }, + "propertyNames": { + "title": "UOM Property Names", + "description": "The list of property names, to which this meta data item provides Unit context to. Data structures, which come in a single frame of reference, can register the property name, others require a full path like \"Data.StructureA.PropertyB\" to define a unique context.", + "type": "array", + "example": [ + "HorizontalDeflection.EastWest", + "HorizontalDeflection.NorthSouth" + ], + "items": { + "type": "string" + } + } + }, + "required": [ + "kind", + "persistableReference" + ] + }, + { + "title": "FrameOfReferenceCRS", + "type": "object", + "properties": { + "kind": { + "title": "CRS Reference Kind", + "description": "The kind of reference, constant 'CRS' for FrameOfReferenceCRS.", + "const": "CRS" + }, + "name": { + "title": "CRS Name", + "description": "The name of the CRS.", + "type": "string", + "example": "NAD27 * OGP-Usa Conus / North Dakota South [32021,15851]" + }, + "persistableReference": { + "title": "CRS Persistable Reference", + "description": "The self-contained, persistable reference string uniquely identifying the CRS.", + "type": "string", + "example": "{\"authCode\":{\"auth\":\"EPSG\",\"code\":\"32615\"},\"type\":\"LBC\",\"ver\":\"PE_10_3_1\",\"name\":\"WGS_1984_UTM_Zone_15N\",\"wkt\":\"PROJCS[\\\"WGS_1984_UTM_Zone_15N\\\",GEOGCS[\\\"GCS_WGS_1984\\\",DATUM[\\\"D_WGS_1984\\\",SPHEROID[\\\"WGS_1984\\\",6378137.0,298.257223563]],PRIMEM[\\\"Greenwich\\\",0.0],UNIT[\\\"Degree\\\",0.0174532925199433]],PROJECTION[\\\"Transverse_Mercator\\\"],PARAMETER[\\\"False_Easting\\\",500000.0],PARAMETER[\\\"False_Northing\\\",0.0],PARAMETER[\\\"Central_Meridian\\\",-93.0],PARAMETER[\\\"Scale_Factor\\\",0.9996],PARAMETER[\\\"Latitude_Of_Origin\\\",0.0],UNIT[\\\"Meter\\\",1.0],AUTHORITY[\\\"EPSG\\\",32615]]\"}" + }, + "coordinateReferenceSystemID": { + "description": "SRN to CRS reference.", + "type": "string", + "pattern": "^srn:<namespace>:reference-data\\/CoordinateReferenceSystem:[^:]+:[0-9]*$", + "example": "srn:<namespace>:reference-data/CoordinateReferenceSystem:EPSG.32615:" + }, + "propertyNames": { + "title": "CRS Property Names", + "description": "The list of property names, to which this meta data item provides CRS context to. Data structures, which come in a single frame of reference, can register the property name, others require a full path like \"Data.StructureA.PropertyB\" to define a unique context.", + "type": "array", + "example": [ + "KickOffPosition.X", + "KickOffPosition.Y" + ], + "items": { + "type": "string" + } + } + }, + "required": [ + "kind", + "persistableReference" + ] + }, + { + "title": "FrameOfReferenceDateTime", + "type": "object", + "properties": { + "kind": { + "title": "DateTime Reference Kind", + "description": "The kind of reference, constant 'DateTime', for FrameOfReferenceDateTime.", + "const": "DateTime" + }, + "name": { + "title": "DateTime Name", + "description": "The name of the DateTime format and reference.", + "type": "string", + "example": "UTC" + }, + "persistableReference": { + "title": "DateTime Persistable Reference", + "description": "The self-contained, persistable reference string uniquely identifying DateTime reference.", + "type": "string", + "example": "{\"format\":\"yyyy-MM-ddTHH:mm:ssZ\",\"timeZone\":\"UTC\",\"type\":\"DTM\"}" + }, + "propertyNames": { + "title": "DateTime Property Names", + "description": "The list of property names, to which this meta data item provides DateTime context to. Data structures, which come in a single frame of reference, can register the property name, others require a full path like \"Data.StructureA.PropertyB\" to define a unique context.", + "type": "array", + "example": [ + "Acquisition.StartTime", + "Acquisition.EndTime" + ], + "items": { + "type": "string" + } + } + }, + "required": [ + "kind", + "persistableReference" + ] + }, + { + "title": "FrameOfReferenceAzimuthReference", + "type": "object", + "properties": { + "kind": { + "title": "AzimuthReference Reference Kind", + "description": "The kind of reference, constant 'AzimuthReference', for FrameOfReferenceAzimuthReference.", + "const": "AzimuthReference" + }, + "name": { + "title": "AzimuthReference Name", + "description": "The name of the CRS or the symbol/name of the unit.", + "type": "string", + "example": "TrueNorth" + }, + "persistableReference": { + "title": "AzimuthReference Persistable Reference", + "description": "The self-contained, persistable reference string uniquely identifying AzimuthReference.", + "type": "string", + "example": "{\"code\":\"TrueNorth\",\"type\":\"AZR\"}" + }, + "propertyNames": { + "title": "AzimuthReference Property Names", + "description": "The list of property names, to which this meta data item provides AzimuthReference context to. Data structures, which come in a single frame of reference, can register the property name, others require a full path like \"Data.StructureA.PropertyB\" to define a unique context.", + "type": "array", + "example": [ + "Bearing" + ], + "items": { + "type": "string" + } + } + }, + "required": [ + "kind", + "persistableReference" + ] + } + ] + }, + "opendes:wks:AbstractFacilityOperator:1.0.0": { + "title": "AbstractFacilityOperator", + "description": "The organisation that was responsible for a facility at some point in time.", + "type": "object", + "properties": { + "FacilityOperatorOrganisationID": { + "description": "The company that currently operates, or previously operated the facility", + "type": "string", + "pattern": "^srn:<namespace>:master-data\\/Organisation:[^:]+:[0-9]*$" + }, + "EffectiveDateTime": { + "description": "The date and time at which the facility operator becomes effective.", + "type": "string", + "format": "date-time" + }, + "TerminationDateTime": { + "description": "The date and time at which the facility operator is no longer in effect.", + "type": "string", + "format": "date-time" + } + } + }, + "opendes:wks:AbstractAnyCrsFeatureCollection:1.0.0": { + "title": "AbstractAnyCrsFeatureCollection", + "description": "A schema like GeoJSON FeatureCollection with a non-WGS 84 CRS context; based on https://geojson.org/schema/FeatureCollection.json. Attention: the coordinate order is fixed: Longitude/Easting/Westing/X first, followed by Latitude/Northing/Southing/Y, optionally height as third coordinate.", + "type": "object", + "required": [ + "type", + "persistableReferenceCRS", + "features" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "AnyCrsFeatureCollection" + ] + }, + "CoordinateReferenceSystemID": { + "title": "Coordinate Reference System ID", + "description": "The CRS reference into the CoordinateReferenceSystem catalog.", + "type": "string", + "pattern": "^srn:<namespace>:reference-data\\/CoordinateReferenceSystem:[^:]+:[0-9]*$", + "example": "srn:<namespace>:reference-data/CoordinateReferenceSystem:BoundCRS.SLB.32021.15851:" + }, + "VerticalCoordinateReferenceSystemID": { + "title": "Vertical Coordinate Reference System ID", + "description": "The explicit VerticalCRS reference into the CoordinateReferenceSystem catalog. This property stays empty for 2D geometries. Absent or empty values for 3D geometries mean the context may be provided by a CompoundCRS in 'CoordinateReferenceSystemID' or implicitly EPSG:5714 MSL height", + "type": "string", + "pattern": "^srn:<namespace>:reference-data\\/CoordinateReferenceSystem:[^:]+:[0-9]*$", + "example": "srn:<namespace>:reference-data/CoordinateReferenceSystem:VerticalCRS.EPSG.5773:" + }, + "persistableReferenceCRS": { + "type": "string", + "title": "CRS Reference", + "description": "The CRS reference as persistableReference string. If populated, the CoordinateReferenceSystemID takes precedence.", + "example": "{\"lateBoundCRS\":{\"wkt\":\"PROJCS[\\\"NAD_1927_StatePlane_North_Dakota_South_FIPS_3302\\\",GEOGCS[\\\"GCS_North_American_1927\\\",DATUM[\\\"D_North_American_1927\\\",SPHEROID[\\\"Clarke_1866\\\",6378206.4,294.9786982]],PRIMEM[\\\"Greenwich\\\",0.0],UNIT[\\\"Degree\\\",0.0174532925199433]],PROJECTION[\\\"Lambert_Conformal_Conic\\\"],PARAMETER[\\\"False_Easting\\\",2000000.0],PARAMETER[\\\"False_Northing\\\",0.0],PARAMETER[\\\"Central_Meridian\\\",-100.5],PARAMETER[\\\"Standard_Parallel_1\\\",46.1833333333333],PARAMETER[\\\"Standard_Parallel_2\\\",47.4833333333333],PARAMETER[\\\"Latitude_Of_Origin\\\",45.6666666666667],UNIT[\\\"Foot_US\\\",0.304800609601219],AUTHORITY[\\\"EPSG\\\",32021]]\",\"ver\":\"PE_10_3_1\",\"name\":\"NAD_1927_StatePlane_North_Dakota_South_FIPS_3302\",\"authCode\":{\"auth\":\"EPSG\",\"code\":\"32021\"},\"type\":\"LBC\"},\"singleCT\":{\"wkt\":\"GEOGTRAN[\\\"NAD_1927_To_WGS_1984_79_CONUS\\\",GEOGCS[\\\"GCS_North_American_1927\\\",DATUM[\\\"D_North_American_1927\\\",SPHEROID[\\\"Clarke_1866\\\",6378206.4,294.9786982]],PRIMEM[\\\"Greenwich\\\",0.0],UNIT[\\\"Degree\\\",0.0174532925199433]],GEOGCS[\\\"GCS_WGS_1984\\\",DATUM[\\\"D_WGS_1984\\\",SPHEROID[\\\"WGS_1984\\\",6378137.0,298.257223563]],PRIMEM[\\\"Greenwich\\\",0.0],UNIT[\\\"Degree\\\",0.0174532925199433]],METHOD[\\\"NADCON\\\"],PARAMETER[\\\"Dataset_conus\\\",0.0],AUTHORITY[\\\"EPSG\\\",15851]]\",\"ver\":\"PE_10_3_1\",\"name\":\"NAD_1927_To_WGS_1984_79_CONUS\",\"authCode\":{\"auth\":\"EPSG\",\"code\":\"15851\"},\"type\":\"ST\"},\"ver\":\"PE_10_3_1\",\"name\":\"NAD27 * OGP-Usa Conus / North Dakota South [32021,15851]\",\"authCode\":{\"auth\":\"SLB\",\"code\":\"32021079\"},\"type\":\"EBC\"}" + }, + "persistableReferenceVerticalCRS": { + "type": "string", + "title": "Vertical CRS Reference", + "description": "The VerticalCRS reference as persistableReference string. If populated, the VerticalCoordinateReferenceSystemID takes precedence. The property is null or empty for 2D geometries. For 3D geometries and absent or null persistableReferenceVerticalCRS the vertical CRS is either provided via persistableReferenceCRS's CompoundCRS or it is implicitly defined as EPSG:5714 MSL height.", + "example": "{\"authCode\":{\"auth\":\"EPSG\",\"code\":\"5773\"},\"type\":\"LBC\",\"ver\":\"PE_10_3_1\",\"name\":\"EGM96_Geoid\",\"wkt\":\"VERTCS[\\\"EGM96_Geoid\\\",VDATUM[\\\"EGM96_Geoid\\\"],PARAMETER[\\\"Vertical_Shift\\\",0.0],PARAMETER[\\\"Direction\\\",1.0],UNIT[\\\"Meter\\\",1.0],AUTHORITY[\\\"EPSG\\\",5773]]\"}" + }, + "persistableReferenceUnitZ": { + "type": "string", + "title": "Z-Unit Reference", + "description": "The unit of measure for the Z-axis (only for 3-dimensional coordinates, where the CRS does not describe the vertical unit). Note that the direction is upwards positive, i.e. Z means height.", + "example": "{\"scaleOffset\":{\"scale\":1.0,\"offset\":0.0},\"symbol\":\"m\",\"baseMeasurement\":{\"ancestry\":\"Length\",\"type\":\"UM\"},\"type\":\"USO\"}" + }, + "features": { + "type": "array", + "items": { + "title": "AnyCrsGeoJSON Feature", + "type": "object", + "required": [ + "type", + "properties", + "geometry" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "AnyCrsFeature" + ] + }, + "properties": { + "oneOf": [ + { + "type": "null" + }, + { + "type": "object" + } + ] + }, + "geometry": { + "oneOf": [ + { + "type": "null" + }, + { + "title": "AnyCrsGeoJSON Point", + "type": "object", + "required": [ + "type", + "coordinates" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "AnyCrsPoint" + ] + }, + "coordinates": { + "type": "array", + "minItems": 2, + "items": { + "type": "number" + } + }, + "bbox": { + "type": "array", + "minItems": 4, + "items": { + "type": "number" + } + } + } + }, + { + "title": "AnyCrsGeoJSON LineString", + "type": "object", + "required": [ + "type", + "coordinates" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "AnyCrsLineString" + ] + }, + "coordinates": { + "type": "array", + "minItems": 2, + "items": { + "type": "array", + "minItems": 2, + "items": { + "type": "number" + } + } + }, + "bbox": { + "type": "array", + "minItems": 4, + "items": { + "type": "number" + } + } + } + }, + { + "title": "AnyCrsGeoJSON Polygon", + "type": "object", + "required": [ + "type", + "coordinates" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "AnyCrsPolygon" + ] + }, + "coordinates": { + "type": "array", + "items": { + "type": "array", + "minItems": 4, + "items": { + "type": "array", + "minItems": 2, + "items": { + "type": "number" + } + } + } + }, + "bbox": { + "type": "array", + "minItems": 4, + "items": { + "type": "number" + } + } + } + }, + { + "title": "AnyCrsGeoJSON MultiPoint", + "type": "object", + "required": [ + "type", + "coordinates" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "AnyCrsMultiPoint" + ] + }, + "coordinates": { + "type": "array", + "items": { + "type": "array", + "minItems": 2, + "items": { + "type": "number" + } + } + }, + "bbox": { + "type": "array", + "minItems": 4, + "items": { + "type": "number" + } + } + } + }, + { + "title": "AnyCrsGeoJSON MultiLineString", + "type": "object", + "required": [ + "type", + "coordinates" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "AnyCrsMultiLineString" + ] + }, + "coordinates": { + "type": "array", + "items": { + "type": "array", + "minItems": 2, + "items": { + "type": "array", + "minItems": 2, + "items": { + "type": "number" + } + } + } + }, + "bbox": { + "type": "array", + "minItems": 4, + "items": { + "type": "number" + } + } + } + }, + { + "title": "AnyCrsGeoJSON MultiPolygon", + "type": "object", + "required": [ + "type", + "coordinates" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "AnyCrsMultiPolygon" + ] + }, + "coordinates": { + "type": "array", + "items": { + "type": "array", + "items": { + "type": "array", + "minItems": 4, + "items": { + "type": "array", + "minItems": 2, + "items": { + "type": "number" + } + } + } + } + }, + "bbox": { + "type": "array", + "minItems": 4, + "items": { + "type": "number" + } + } + } + }, + { + "title": "AnyCrsGeoJSON GeometryCollection", + "type": "object", + "required": [ + "type", + "geometries" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "AnyCrsGeometryCollection" + ] + }, + "geometries": { + "type": "array", + "items": { + "oneOf": [ + { + "title": "AnyCrsGeoJSON Point", + "type": "object", + "required": [ + "type", + "coordinates" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "AnyCrsPoint" + ] + }, + "coordinates": { + "type": "array", + "minItems": 2, + "items": { + "type": "number" + } + }, + "bbox": { + "type": "array", + "minItems": 4, + "items": { + "type": "number" + } + } + } + }, + { + "title": "AnyCrsGeoJSON LineString", + "type": "object", + "required": [ + "type", + "coordinates" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "AnyCrsLineString" + ] + }, + "coordinates": { + "type": "array", + "minItems": 2, + "items": { + "type": "array", + "minItems": 2, + "items": { + "type": "number" + } + } + }, + "bbox": { + "type": "array", + "minItems": 4, + "items": { + "type": "number" + } + } + } + }, + { + "title": "AnyCrsGeoJSON Polygon", + "type": "object", + "required": [ + "type", + "coordinates" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "AnyCrsPolygon" + ] + }, + "coordinates": { + "type": "array", + "items": { + "type": "array", + "minItems": 4, + "items": { + "type": "array", + "minItems": 2, + "items": { + "type": "number" + } + } + } + }, + "bbox": { + "type": "array", + "minItems": 4, + "items": { + "type": "number" + } + } + } + }, + { + "title": "AnyCrsGeoJSON MultiPoint", + "type": "object", + "required": [ + "type", + "coordinates" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "AnyCrsMultiPoint" + ] + }, + "coordinates": { + "type": "array", + "items": { + "type": "array", + "minItems": 2, + "items": { + "type": "number" + } + } + }, + "bbox": { + "type": "array", + "minItems": 4, + "items": { + "type": "number" + } + } + } + }, + { + "title": "AnyCrsGeoJSON MultiLineString", + "type": "object", + "required": [ + "type", + "coordinates" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "AnyCrsMultiLineString" + ] + }, + "coordinates": { + "type": "array", + "items": { + "type": "array", + "minItems": 2, + "items": { + "type": "array", + "minItems": 2, + "items": { + "type": "number" + } + } + } + }, + "bbox": { + "type": "array", + "minItems": 4, + "items": { + "type": "number" + } + } + } + }, + { + "title": "AnyCrsGeoJSON MultiPolygon", + "type": "object", + "required": [ + "type", + "coordinates" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "AnyCrsMultiPolygon" + ] + }, + "coordinates": { + "type": "array", + "items": { + "type": "array", + "items": { + "type": "array", + "minItems": 4, + "items": { + "type": "array", + "minItems": 2, + "items": { + "type": "number" + } + } + } + } + }, + "bbox": { + "type": "array", + "minItems": 4, + "items": { + "type": "number" + } + } + } + } + ] + } + }, + "bbox": { + "type": "array", + "minItems": 4, + "items": { + "type": "number" + } + } + } + } + ] + }, + "bbox": { + "type": "array", + "minItems": 4, + "items": { + "type": "number" + } + } + } + } + }, + "bbox": { + "type": "array", + "minItems": 4, + "items": { + "type": "number" + } + } + } + }, + "opendes:wks:AbstractFeatureCollection:1.0.0": { + "description": "GeoJSON feature collection as originally published in https://geojson.org/schema/FeatureCollection.json. Attention: the coordinate order is fixed: Longitude first, followed by Latitude, optionally height above MSL (EPSG:5714) as third coordinate.", + "title": "GeoJSON FeatureCollection", + "type": "object", + "required": [ + "type", + "features" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "FeatureCollection" + ] + }, + "features": { + "type": "array", + "items": { + "title": "GeoJSON Feature", + "type": "object", + "required": [ + "type", + "properties", + "geometry" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Feature" + ] + }, + "properties": { + "oneOf": [ + { + "type": "null" + }, + { + "type": "object" + } + ] + }, + "geometry": { + "oneOf": [ + { + "type": "null" + }, + { + "title": "GeoJSON Point", + "type": "object", + "required": [ + "type", + "coordinates" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Point" + ] + }, + "coordinates": { + "type": "array", + "minItems": 2, + "items": { + "type": "number" + } + }, + "bbox": { + "type": "array", + "minItems": 4, + "items": { + "type": "number" + } + } + } + }, + { + "title": "GeoJSON LineString", + "type": "object", + "required": [ + "type", + "coordinates" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "LineString" + ] + }, + "coordinates": { + "type": "array", + "minItems": 2, + "items": { + "type": "array", + "minItems": 2, + "items": { + "type": "number" + } + } + }, + "bbox": { + "type": "array", + "minItems": 4, + "items": { + "type": "number" + } + } + } + }, + { + "title": "GeoJSON Polygon", + "type": "object", + "required": [ + "type", + "coordinates" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Polygon" + ] + }, + "coordinates": { + "type": "array", + "items": { + "type": "array", + "minItems": 4, + "items": { + "type": "array", + "minItems": 2, + "items": { + "type": "number" + } + } + } + }, + "bbox": { + "type": "array", + "minItems": 4, + "items": { + "type": "number" + } + } + } + }, + { + "title": "GeoJSON MultiPoint", + "type": "object", + "required": [ + "type", + "coordinates" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "MultiPoint" + ] + }, + "coordinates": { + "type": "array", + "items": { + "type": "array", + "minItems": 2, + "items": { + "type": "number" + } + } + }, + "bbox": { + "type": "array", + "minItems": 4, + "items": { + "type": "number" + } + } + } + }, + { + "title": "GeoJSON MultiLineString", + "type": "object", + "required": [ + "type", + "coordinates" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "MultiLineString" + ] + }, + "coordinates": { + "type": "array", + "items": { + "type": "array", + "minItems": 2, + "items": { + "type": "array", + "minItems": 2, + "items": { + "type": "number" + } + } + } + }, + "bbox": { + "type": "array", + "minItems": 4, + "items": { + "type": "number" + } + } + } + }, + { + "title": "GeoJSON MultiPolygon", + "type": "object", + "required": [ + "type", + "coordinates" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "MultiPolygon" + ] + }, + "coordinates": { + "type": "array", + "items": { + "type": "array", + "items": { + "type": "array", + "minItems": 4, + "items": { + "type": "array", + "minItems": 2, + "items": { + "type": "number" + } + } + } + } + }, + "bbox": { + "type": "array", + "minItems": 4, + "items": { + "type": "number" + } + } + } + }, + { + "title": "GeoJSON GeometryCollection", + "type": "object", + "required": [ + "type", + "geometries" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "GeometryCollection" + ] + }, + "geometries": { + "type": "array", + "items": { + "oneOf": [ + { + "title": "GeoJSON Point", + "type": "object", + "required": [ + "type", + "coordinates" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Point" + ] + }, + "coordinates": { + "type": "array", + "minItems": 2, + "items": { + "type": "number" + } + }, + "bbox": { + "type": "array", + "minItems": 4, + "items": { + "type": "number" + } + } + } + }, + { + "title": "GeoJSON LineString", + "type": "object", + "required": [ + "type", + "coordinates" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "LineString" + ] + }, + "coordinates": { + "type": "array", + "minItems": 2, + "items": { + "type": "array", + "minItems": 2, + "items": { + "type": "number" + } + } + }, + "bbox": { + "type": "array", + "minItems": 4, + "items": { + "type": "number" + } + } + } + }, + { + "title": "GeoJSON Polygon", + "type": "object", + "required": [ + "type", + "coordinates" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "Polygon" + ] + }, + "coordinates": { + "type": "array", + "items": { + "type": "array", + "minItems": 4, + "items": { + "type": "array", + "minItems": 2, + "items": { + "type": "number" + } + } + } + }, + "bbox": { + "type": "array", + "minItems": 4, + "items": { + "type": "number" + } + } + } + }, + { + "title": "GeoJSON MultiPoint", + "type": "object", + "required": [ + "type", + "coordinates" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "MultiPoint" + ] + }, + "coordinates": { + "type": "array", + "items": { + "type": "array", + "minItems": 2, + "items": { + "type": "number" + } + } + }, + "bbox": { + "type": "array", + "minItems": 4, + "items": { + "type": "number" + } + } + } + }, + { + "title": "GeoJSON MultiLineString", + "type": "object", + "required": [ + "type", + "coordinates" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "MultiLineString" + ] + }, + "coordinates": { + "type": "array", + "items": { + "type": "array", + "minItems": 2, + "items": { + "type": "array", + "minItems": 2, + "items": { + "type": "number" + } + } + } + }, + "bbox": { + "type": "array", + "minItems": 4, + "items": { + "type": "number" + } + } + } + }, + { + "title": "GeoJSON MultiPolygon", + "type": "object", + "required": [ + "type", + "coordinates" + ], + "properties": { + "type": { + "type": "string", + "enum": [ + "MultiPolygon" + ] + }, + "coordinates": { + "type": "array", + "items": { + "type": "array", + "items": { + "type": "array", + "minItems": 4, + "items": { + "type": "array", + "minItems": 2, + "items": { + "type": "number" + } + } + } + } + }, + "bbox": { + "type": "array", + "minItems": 4, + "items": { + "type": "number" + } + } + } + } + ] + } + }, + "bbox": { + "type": "array", + "minItems": 4, + "items": { + "type": "number" + } + } + } + } + ] + }, + "bbox": { + "type": "array", + "minItems": 4, + "items": { + "type": "number" + } + } + } + } + }, + "bbox": { + "type": "array", + "minItems": 4, + "items": { + "type": "number" + } + } + } + }, + "opendes:wks:AbstractSpatialLocation:1.0.0": { + "title": "AbstractSpatialLocation", + "description": "A geographic object which can be described by a set of points.", + "type": "object", + "properties": { + "SpatialLocationCoordinatesDate": { + "description": "Date when coordinates were measured or retrieved.", + "type": "string", + "format": "date-time" + }, + "QuantitativeAccuracyBandID": { + "description": "An approximate quantitative assessment of the quality of a location (accurate to > 500 m (i.e. not very accurate)), to < 1 m, etc.", + "type": "string", + "pattern": "^srn:<namespace>:reference-data\\/QuantitativeAccuracyBand:[^:]+:[0-9]*$" + }, + "QualitativeSpatialAccuracyTypeID": { + "description": "A qualitative description of the quality of a spatial location, e.g. unverifiable, not verified, basic validation.", + "type": "string", + "pattern": "^srn:<namespace>:reference-data\\/QualitativeSpatialAccuracyType:[^:]+:[0-9]*$" + }, + "CoordinateQualityCheckPerformedBy": { + "description": "The user who performed the Quality Check.", + "type": "string" + }, + "CoordinateQualityCheckDateTime": { + "description": "The date of the Quality Check.", + "type": "string", + "format": "date-time" + }, + "CoordinateQualityCheckRemarks": { + "description": "Freetext remarks on Quality Check.", + "type": "array", + "items": { + "type": "string" + } + }, + "AsIngestedCoordinates": { + "title": "As Ingested Coordinates", + "description": "The original or 'as ingested' coordinates (Point, MultiPoint, LineString, MultiLineString, Polygon or MultiPolygon). The name 'AsIngestedCoordinates' was chosen to contrast it to 'OriginalCoordinates', which carries the uncertainty whether any coordinate operations took place before ingestion. In cases where the original CRS is different from the as-ingested CRS, the OperationsApplied can also contain the list of operations applied to the coordinate prior to ingestion. The data structure is similar to GeoJSON FeatureCollection, however in a CRS context explicitly defined within the AbstractAnyCrsFeatureCollection. The coordinate sequence follows GeoJSON standard, i.e. 'eastward/longitude', 'northward/latitude' {, 'upward/height' unless overridden by an explicit direction in the AsIngestedCoordinates.VerticalCoordinateReferenceSystemID}.", + "$ref": "#/definitions/opendes:wks:AbstractAnyCrsFeatureCollection:1.0.0", + "x-osdu-frame-of-reference": "CRS:" + }, + "Wgs84Coordinates": { + "title": "WGS 84 Coordinates", + "description": "The normalized coordinates (Point, MultiPoint, LineString, MultiLineString, Polygon or MultiPolygon) based on WGS 84 (EPSG:4326 for 2-dimensional coordinates, EPSG:4326 + EPSG:5714 (MSL) for 3-dimensional coordinates). This derived coordinate representation is intended for global discoverability only. The schema of this substructure is identical to the GeoJSON FeatureCollection https://geojson.org/schema/FeatureCollection.json. The coordinate sequence follows GeoJSON standard, i.e. longitude, latitude {, height}", + "$ref": "#/definitions/opendes:wks:AbstractFeatureCollection:1.0.0" + }, + "OperationsApplied": { + "title": "Operations Applied", + "description": "The audit trail of operations applied to the coordinates from the original state to the current state. The list may contain operations applied prior to ingestion as well as the operations applied to produce the Wgs84Coordinates. The text elements refer to ESRI style CRS and Transformation names, which may have to be translated to EPSG standard names.", + "type": "array", + "items": { + "type": "string" + }, + "example": [ + "conversion from ED_1950_UTM_Zone_31N to GCS_European_1950; 1 points converted", + "transformation GCS_European_1950 to GCS_WGS_1984 using ED_1950_To_WGS_1984_24; 1 points successfully transformed" + ] + }, + "SpatialParameterTypeID": { + "description": "A type of spatial representation of an object, often general (e.g. an Outline, which could be applied to Field, Reservoir, Facility, etc.) or sometimes specific (e.g. Onshore Outline, State Offshore Outline, Federal Offshore Outline, 3 spatial representations that may be used by Countries).", + "type": "string", + "pattern": "^srn:<namespace>:reference-data\\/SpatialParameterType:[^:]+:[0-9]*$" + }, + "SpatialGeometryTypeID": { + "description": "Indicates the expected look of the SpatialParameterType, e.g. Point, MultiPoint, LineString, MultiLineString, Polygon, MultiPolygon. The value constrains the type of geometries in the GeoJSON Wgs84Coordinates and AsIngestedCoordinates.", + "type": "string", + "pattern": "^srn:<namespace>:reference-data\\/SpatialGeometryType:[^:]+:[0-9]*$" + } + } + }, + "opendes:wks:AbstractGeoPoliticalContext:1.0.0": { + "title": "AbstractGeoPoliticalContext", + "description": "A single, typed geo-political entity reference, which is 'abstracted' to AbstractGeoContext and then aggregated by GeoContexts properties.", + "type": "object", + "properties": { + "GeoPoliticalEntityID": { + "type": "string", + "description": "Reference to GeoPoliticalEntity.", + "pattern": "^srn:<namespace>:master-data\\/GeoPoliticalEntity:[^:]+:[0-9]*$" + }, + "GeoTypeID": { + "type": "string", + "description": "The GeoPoliticalEntityType reference of the GeoPoliticalEntity (via GeoPoliticalEntityID) for application convenience.", + "pattern": "^srn:<namespace>:reference-data\\/GeoPoliticalEntityType:[^:]+:[0-9]*$" + } + } + }, + "opendes:wks:AbstractGeoBasinContext:1.0.0": { + "title": "AbstractGeoBasinContext", + "description": "A single, typed basin entity reference, which is 'abstracted' to AbstractGeoContext and then aggregated by GeoContexts properties.", + "type": "object", + "properties": { + "BasinID": { + "type": "string", + "description": "Reference to Basin.", + "pattern": "^srn:<namespace>:master-data\\/Basin:[^:]+:[0-9]*$" + }, + "GeoTypeID": { + "description": "The BasinType reference of the Basin (via BasinID) for application convenience.", + "type": "string", + "pattern": "^srn:<namespace>:reference-data\\/BasinType:[^:]+:[0-9]*$" + } + } + }, + "opendes:wks:AbstractGeoFieldContext:1.0.0": { + "title": "AbstractGeoFieldContext", + "description": "A single, typed field entity reference, which is 'abstracted' to AbstractGeoContext and then aggregated by GeoContexts properties.", + "type": "object", + "properties": { + "FieldID": { + "type": "string", + "description": "Reference to Field.", + "pattern": "^srn:<namespace>:master-data\\/Field:[^:]+:[0-9]*$" + }, + "GeoTypeID": { + "const": "Field", + "description": "The fixed type 'Field' for this AbstractGeoFieldContext." + } + } + }, + "opendes:wks:AbstractGeoPlayContext:1.0.0": { + "title": "AbstractGeoPlayContext", + "description": "A single, typed Play entity reference, which is 'abstracted' to AbstractGeoContext and then aggregated by GeoContexts properties.", + "type": "object", + "properties": { + "PlayID": { + "type": "string", + "description": "Reference to the play.", + "pattern": "^srn:<namespace>:master-data\\/Play:[^:]+:[0-9]*$" + }, + "GeoTypeID": { + "type": "string", + "description": "The PlayType reference of the Play (via PlayID) for application convenience.", + "pattern": "^srn:<namespace>:reference-data\\/PlayType:[^:]+:[0-9]*$" + } + } + }, + "opendes:wks:AbstractGeoProspectContext:1.0.0": { + "title": "AbstractGeoProspectContext", + "description": "A single, typed Prospect entity reference, which is 'abstracted' to AbstractGeoContext and then aggregated by GeoContexts properties.", + "type": "object", + "properties": { + "ProspectID": { + "type": "string", + "description": "Reference to the prospect.", + "pattern": "^srn:<namespace>:master-data\\/Prospect:[^:]+:[0-9]*$" + }, + "GeoTypeID": { + "type": "string", + "description": "The ProspectType reference of the Prospect (via ProspectID) for application convenience.", + "pattern": "^srn:<namespace>:reference-data\\/ProspectType:[^:]+:[0-9]*$" + } + } + }, + "opendes:wks:AbstractGeoContext:1.0.0": { + "title": "AbstractGeoContext", + "description": "A geographic context to an entity. It can be either a reference to a GeoPoliticalEntity, Basin, Field, Play or Prospect.", + "oneOf": [ + { + "$ref": "#/definitions/opendes:wks:AbstractGeoPoliticalContext:1.0.0" + }, + { + "$ref": "#/definitions/opendes:wks:AbstractGeoBasinContext:1.0.0" + }, + { + "$ref": "#/definitions/opendes:wks:AbstractGeoFieldContext:1.0.0" + }, + { + "$ref": "#/definitions/opendes:wks:AbstractGeoPlayContext:1.0.0" + }, + { + "$ref": "#/definitions/opendes:wks:AbstractGeoProspectContext:1.0.0" + } + ] + }, + "opendes:wks:AbstractAliasNames:1.0.0": { + "title": "AbstractAliasNames", + "description": "A list of alternative names for an object. The preferred name is in a separate, scalar property. It may or may not be repeated in the alias list, though a best practice is to include it if the list is present, but to omit the list if there are no other names. Note that the abstract entity is an array so the $ref to it is a simple property reference.", + "type": "object", + "properties": { + "AliasName": { + "description": "Alternative Name value of defined name type for an object.", + "type": "string" + }, + "AliasNameTypeID": { + "description": "A classification of alias names such as by role played or type of source, such as regulatory name, regulatory code, company code, international standard name, etc.", + "type": "string", + "pattern": "^srn:<namespace>:reference-data\\/AliasNameType:[^:]+:[0-9]*$" + }, + "DefinitionOrganisationID": { + "description": "Organisation that provided the name (the source).", + "type": "string", + "pattern": "^srn:<namespace>:master-data\\/Organisation:[^:]+:[0-9]*$" + }, + "EffectiveDateTime": { + "description": "The date and time when an alias name becomes effective.", + "type": "string", + "format": "date-time" + }, + "TerminationDateTime": { + "description": "The data and time when an alias name is no longer in effect.", + "type": "string", + "format": "date-time" + } + } + }, + "opendes:wks:AbstractFacilityState:1.0.0": { + "title": "AbstractFacilityState", + "description": "The life cycle status of a facility at some point in time.", + "type": "object", + "properties": { + "EffectiveDateTime": { + "description": "The date and time at which the facility state becomes effective.", + "type": "string", + "format": "date-time" + }, + "TerminationDateTime": { + "description": "The date and time at which the facility state is no longer in effect.", + "type": "string", + "format": "date-time" + }, + "FacilityStateTypeID": { + "description": "The facility life cycle state from planning to abandonment.", + "type": "string", + "pattern": "^srn:<namespace>:reference-data\\/FacilityStateType:[^:]+:[0-9]*$" + } + } + }, + "opendes:wks:AbstractFacilityEvent:1.0.0": { + "title": "AbstractFacilityEvent", + "description": "A significant occurrence in the life of a facility, which often changes its state, or the state of one of its components.", + "type": "object", + "properties": { + "FacilityEventTypeID": { + "description": "The facility event type is a picklist. Examples: Propose, Completion, Entry Date etc.", + "type": "string", + "pattern": "^srn:<namespace>:reference-data\\/FacilityEventType:[^:]+:[0-9]*$" + }, + "EffectiveDateTime": { + "description": "The date and time at which the event becomes effective.", + "type": "string", + "format": "date-time" + }, + "TerminationDateTime": { + "description": "The date and time at which the event is no longer in effect.", + "type": "string", + "format": "date-time" + } + } + }, + "opendes:wks:AbstractFacilitySpecification:1.0.0": { + "title": "AbstractFacilitySpecification", + "description": "A property, characteristic, or attribute about a facility that is not described explicitly elsewhere.", + "type": "object", + "properties": { + "EffectiveDateTime": { + "description": "The date and time at which the facility specification instance becomes effective.", + "type": "string", + "format": "date-time" + }, + "TerminationDateTime": { + "description": "The date and time at which the facility specification instance is no longer in effect.", + "format": "date-time", + "type": "string" + }, + "FacilitySpecificationQuantity": { + "description": "The value for the specified parameter type.", + "type": "number", + "x-osdu-frame-of-reference": "UOM_via_property:UnitOfMeasureID" + }, + "FacilitySpecificationDateTime": { + "description": "The actual date and time value of the parameter.", + "type": "string", + "format": "date-time" + }, + "FacilitySpecificationIndicator": { + "description": "The actual indicator value of the parameter.", + "type": "bool" + }, + "FacilitySpecificationText": { + "description": "The actual text value of the parameter.", + "type": "string" + }, + "UnitOfMeasureID": { + "description": "The unit for the quantity parameter, like metre (m in SI units system) for quantity Length.", + "type": "string", + "pattern": "^srn:<namespace>:reference-data\\/UnitOfMeasure:[^:]+:[0-9]*$" + }, + "ParameterTypeID": { + "description": "Parameter type of property or characteristic.", + "type": "string", + "pattern": "^srn:<namespace>:reference-data\\/ParameterType:[^:]+:[0-9]*$" + } + } + }, + "opendes:wks:AbstractFacility:1.0.0": { + "title": "AbstractFacility", + "description": "", + "type": "object", + "properties": { + "FacilityID": { + "description": "A system-specified unique identifier of a Facility.", + "type": "string" + }, + "FacilityTypeID": { + "description": "The definition of a kind of capability to perform a business function or a service.", + "type": "string", + "pattern": "^srn:<namespace>:reference-data\\/FacilityType:[^:]+:[0-9]*$" + }, + "FacilityOperator": { + "description": "The history of operator organizations of the facility.", + "type": "array", + "items": { + "$ref": "#/definitions/opendes:wks:AbstractFacilityOperator:1.0.0" + } + }, + "DataSourceOrganisationID": { + "description": "The main source of the header information.", + "type": "string", + "pattern": "^srn:<namespace>:master-data\\/Organisation:[^:]+:[0-9]*$" + }, + "SpatialLocation": { + "description": "The spatial location information such as coordinates,CRS information.", + "type": "array", + "items": { + "$ref": "#/definitions/opendes:wks:AbstractSpatialLocation:1.0.0" + } + }, + "GeoContexts": { + "description": "List of geographic entities which provide context to the facility. This may include multiple types or multiple values of the same type.", + "type": "array", + "items": { + "$ref": "#/definitions/opendes:wks:AbstractGeoContext:1.0.0" + } + }, + "OperatingEnvironmentID": { + "description": "Identifies the Facility's general location as being onshore vs. offshore.", + "type": "string", + "pattern": "^srn:<namespace>:reference-data\\/OperatingEnvironment:[^:]+:[0-9]*$" + }, + "FacilityName": { + "description": "Name of the Facility.", + "type": "string" + }, + "FacilityNameAlias": { + "description": "Alternative names, including historical, by which this facility is/has been known.", + "type": "array", + "items": { + "$ref": "#/definitions/opendes:wks:AbstractAliasNames:1.0.0" + } + }, + "FacilityState": { + "description": "The history of life cycle states the facility has been through.", + "type": "array", + "items": { + "$ref": "#/definitions/opendes:wks:AbstractFacilityState:1.0.0" + } + }, + "FacilityEvent": { + "description": "A list of key facility events.", + "type": "array", + "items": { + "$ref": "#/definitions/opendes:wks:AbstractFacilityEvent:1.0.0" + } + }, + "FacilitySpecification": { + "description": "facilitySpecification maintains the specification like slot name, wellbore drilling permit number, rig name etc.", + "type": "array", + "items": { + "$ref": "#/definitions/opendes:wks:AbstractFacilitySpecification:1.0.0" + } + } + } + }, + "opendes:wks:AbstractFacilityVerticalMeasurement:1.0.0": { + "title": "AbstractFacilityVerticalMeasurement", + "description": "A location along a wellbore, _usually_ associated with some aspect of the drilling of the wellbore, but not with any intersecting _subsurface_ natural surfaces.", + "type": "object", + "properties": { + "VerticalMeasurementID": { + "description": "The ID for a distinct vertical measurement within the Facility array so that it may be referenced by other vertical measurements if necessary.", + "type": "string" + }, + "EffectiveDateTime": { + "description": "The date and time at which a vertical measurement instance becomes effective.", + "type": "string", + "format": "date-time" + }, + "VerticalMeasurement": { + "description": "The value of the elevation or depth. Depth is positive downwards from a vertical reference or geodetic datum along a path, which can be vertical; elevation is positive upwards from a geodetic datum along a vertical path. Either can be negative.", + "type": "number", + "x-osdu-frame-of-reference": "UOM_via_property:VerticalMeasurementUnitOfMeasureID" + }, + "TerminationDateTime": { + "description": "The date and time at which a vertical measurement instance is no longer in effect.", + "type": "string", + "format": "date-time" + }, + "VerticalMeasurementTypeID": { + "description": "Specifies the type of vertical measurement (TD, Plugback, Kickoff, Drill Floor, Rotary Table...).", + "type": "string", + "pattern": "^srn:<namespace>:reference-data\\/VerticalMeasurementType:[^:]+:[0-9]*$" + }, + "VerticalMeasurementPathID": { + "description": "Specifies Measured Depth, True Vertical Depth, or Elevation.", + "type": "string", + "pattern": "^srn:<namespace>:reference-data\\/VerticalMeasurementPath:[^:]+:[0-9]*$" + }, + "VerticalMeasurementSourceID": { + "description": "Specifies Driller vs Logger.", + "type": "string", + "pattern": "^srn:<namespace>:reference-data\\/VerticalMeasurementSource:[^:]+:[0-9]*$" + }, + "WellboreTVDTrajectoryID": { + "description": "Specifies what directional survey or wellpath was used to calculate the TVD.", + "type": "string", + "pattern": "^srn:<namespace>:work-product-component\\/WellboreTrajectory:[^:]+:[0-9]*$" + }, + "VerticalMeasurementUnitOfMeasureID": { + "description": "The unit of measure for the vertical measurement. If a unit of measure and a vertical CRS are provided, the unit of measure provided is taken over the unit of measure from the CRS.", + "type": "string", + "pattern": "^srn:<namespace>:reference-data\\/UnitOfMeasure:[^:]+:[0-9]*$" + }, + "VerticalCRSID": { + "description": "Vertical CRS. It is expected that a Vertical CRS or a Vertical Reference is provided, but not both.", + "type": "string", + "pattern": "^srn:<namespace>:reference-data\\/CoordinateReferenceSystem:[^:]+:[0-9]*$" + }, + "VerticalReferenceID": { + "description": "The reference point from which the vertical measurement is made. Must resolve ultimately to a vertical CRS. It is expected that a Vertical CRS or a Vertical Reference is provided, but not both.", + "type": "string" + }, + "VerticalMeasurementDescription": { + "description": "Text which describes a vertical measurement in detail.", + "type": "string" + } + } + }, + "opendes:wks:AbstractWellboreDrillingReason:1.0.0": { + "title": "AbstractWellboreDrillingReason", + "description": "Purpose for drilling a wellbore, which often is an indication of the level of risk.", + "type": "object", + "properties": { + "DrillingReasonTypeID": { + "description": "Identifier of the drilling reason type for the corresponding time period.", + "type": "string", + "pattern": "^srn:<namespace>:reference-data\\/DrillingReasonType:[^:]+:[0-9]*$" + }, + "EffectiveDateTime": { + "description": "The date and time at which the event becomes effective.", + "type": "string", + "format": "date-time" + }, + "TerminationDateTime": { + "description": "The date and time at which the event is no longer in effect.", + "type": "string", + "format": "date-time" + } + } + } + } +} \ No newline at end of file diff --git a/provider/indexer-gcp/src/test/java/org/opengroup/osdu/indexer/service/IndexerSchemaServiceTest.java b/provider/indexer-gcp/src/test/java/org/opengroup/osdu/indexer/service/IndexerSchemaServiceTest.java index 6bae37e26cfb840db56275fe1a42f0afa8557677..631c840c22670a08200664c66aa8a0f82fc70ae6 100644 --- a/provider/indexer-gcp/src/test/java/org/opengroup/osdu/indexer/service/IndexerSchemaServiceTest.java +++ b/provider/indexer-gcp/src/test/java/org/opengroup/osdu/indexer/service/IndexerSchemaServiceTest.java @@ -29,7 +29,7 @@ import org.opengroup.osdu.indexer.provider.interfaces.ISchemaCache; import org.opengroup.osdu.core.common.model.indexer.IndexSchema; import org.opengroup.osdu.core.common.model.http.RequestStatus; import org.opengroup.osdu.core.common.search.IndicesService; -import org.opengroup.osdu.indexer.service.impl.SchemaProviderImpl; +import org.opengroup.osdu.indexer.service.SchemaProviderImpl; import org.opengroup.osdu.indexer.util.ElasticClientHandler; import org.opengroup.osdu.core.common.search.ElasticIndexNameResolver; import org.powermock.core.classloader.annotations.PrepareForTest; diff --git a/provider/indexer-reference/src/test/java/org/opengroup/osdu/indexer/service/IndexerSchemaServiceTest.java b/provider/indexer-reference/src/test/java/org/opengroup/osdu/indexer/service/IndexerSchemaServiceTest.java index 4ce6eb4e8af4a45eddbc163baad9bb9cd6c2ef12..3b59eb203d3c9bd4391b0a25325ec30e70d06257 100644 --- a/provider/indexer-reference/src/test/java/org/opengroup/osdu/indexer/service/IndexerSchemaServiceTest.java +++ b/provider/indexer-reference/src/test/java/org/opengroup/osdu/indexer/service/IndexerSchemaServiceTest.java @@ -54,7 +54,7 @@ import org.opengroup.osdu.core.common.model.indexer.OperationType; import org.opengroup.osdu.core.common.search.ElasticIndexNameResolver; import org.opengroup.osdu.core.common.search.IndicesService; import org.opengroup.osdu.indexer.provider.interfaces.ISchemaCache; -import org.opengroup.osdu.indexer.service.impl.SchemaProviderImpl; +import org.opengroup.osdu.indexer.service.SchemaProviderImpl; import org.opengroup.osdu.indexer.util.ElasticClientHandler; import org.powermock.core.classloader.annotations.PrepareForTest; import org.springframework.test.context.junit4.SpringRunner;