Commit effb070f authored by Abhishek Kumar's avatar Abhishek Kumar
Browse files

Merge branch 'schema-ref-issue-slb' into 'master'

Resolving ref in definition section

See merge request !105
parents fc67e09e 7e6a4775
Pipeline #43869 passed with stages
in 32 minutes and 14 seconds
......@@ -353,6 +353,7 @@ The following software have components provided under the terms of this license:
- Guava ListenableFuture only (from )
- Guava: Google Core Libraries for Java (from https://github.com/google/guava.git)
- Guava: Google Core Libraries for Java (from https://github.com/google/guava.git)
- Guava: Google Core Libraries for Java (from https://github.com/google/guava.git)
- HPPC Collections (from http://labs.carrotsearch.com)
- Hibernate Validator Engine (from )
- Hibernate Validator Engine (from )
......@@ -434,8 +435,8 @@ The following software have components provided under the terms of this license:
- Microsoft Azure Java Core Library (from https://github.com/Azure/azure-sdk-for-java)
- Microsoft Azure Netty HTTP Client Library (from https://github.com/Azure/azure-sdk-for-java)
- Microsoft Azure SDK for SQL API of Azure Cosmos DB Service (from https://github.com/Azure/azure-sdk-for-java)
- Mockito (from http://www.mockito.org)
- Mockito (from http://mockito.org)
- Mockito (from http://www.mockito.org)
- Netty Reactive Streams HTTP support (from )
- Netty Reactive Streams Implementation (from )
- Netty/Buffer (from http://netty.io/)
......@@ -536,6 +537,7 @@ The following software have components provided under the terms of this license:
- elasticsearch-core (from https://github.com/elastic/elasticsearch)
- elasticsearch-geo (from https://github.com/elastic/elasticsearch)
- error-prone annotations (from )
- error-prone annotations (from )
- google-auth (from https://github.com/GoogleCloudPlatform/google-auth-library-python)
- io.grpc:grpc-alts (from https://github.com/grpc/grpc-java)
- io.grpc:grpc-api (from https://github.com/grpc/grpc-java)
......@@ -840,6 +842,7 @@ The following software have components provided under the terms of this license:
- Azure Spring Boot AutoConfigure (from https://github.com/Microsoft/azure-spring-boot)
- Checker Qual (from https://checkerframework.org)
- Checker Qual (from https://checkerframework.org)
- Checker Qual (from https://checkerframework.org)
- Cucumber Expressions (from https://github.com/cucumber/cucumber-expressions-java)
- Cucumber Tag Expressions (from https://github.com/cucumber/tag-expressions-java)
- Cucumber-JVM: Core (from )
......@@ -875,8 +878,8 @@ The following software have components provided under the terms of this license:
- Microsoft Azure client library for KeyVault Secrets (from https://github.com/Azure/azure-sdk-for-java)
- Microsoft Azure common module for Storage (from https://github.com/Azure/azure-sdk-for-java)
- Microsoft Azure internal Avro module for Storage (from https://github.com/Azure/azure-sdk-for-java)
- Mockito (from http://www.mockito.org)
- Mockito (from http://mockito.org)
- Mockito (from http://www.mockito.org)
- Netty/Codec/HTTP (from )
- Netty/Codec/HTTP (from )
- Netty/Common (from )
......@@ -945,6 +948,7 @@ SPL-1.0
========================================================================
The following software have components provided under the terms of this license:
- Checker Qual (from https://checkerframework.org)
- Checker Qual (from https://checkerframework.org)
========================================================================
......@@ -965,6 +969,7 @@ The following software have components provided under the terms of this license:
- Asynchronous Http Client (from )
- Guava: Google Core Libraries for Java (from https://github.com/google/guava.git)
- Guava: Google Core Libraries for Java (from https://github.com/google/guava.git)
- Guava: Google Core Libraries for Java (from https://github.com/google/guava.git)
- HdrHistogram (from http://hdrhistogram.github.io/HdrHistogram/)
- HdrHistogram (from http://hdrhistogram.github.io/HdrHistogram/)
- Joda-Time (from http://www.joda.org/joda-time/)
......@@ -988,6 +993,7 @@ unknown
The following software have components provided under the terms of this license:
- Byte Buddy (without dependencies) (from )
- Checker Qual (from https://checkerframework.org)
- JSON in Java (from https://github.com/douglascrockford/JSON-java)
- JUnit (from http://junit.org)
- JUnit (from http://junit.org)
......
......@@ -5,6 +5,7 @@ import static org.junit.Assert.fail;
import java.io.IOException;
import org.json.JSONException;
import org.json.JSONObject;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
......@@ -84,6 +85,18 @@ public class SchemaResolverTest {
expectedException.expectMessage("Invalid Request, https://ggl.json not resolvable");
schemaResolver.resolveSchema(orginalSchema);
}
@Test
public void testResolveSchema_RefResolutionUnderDefinitions()
throws JSONException, BadRequestException, ApplicationException, NotFoundException, IOException {
String orginalSchema = new FileUtils().read("/test_schema/originalSchemaWithRefInsideDefinationBlock.json");
String referenceSchema = new FileUtils().read("/test_schema/referenceSchemaWithDefinitionBlock.json");
String expectedOutPut = new FileUtils().read("/test_schema/resolvedSchemaWithRefInsideDefinationBlock.json");
Mockito.when(schemaService.getSchema("os:wks:anyCrsFeatureCollection.1.0")).thenReturn(referenceSchema);
String resolvedSchema = schemaResolver.resolveSchema(orginalSchema);
System.out.println(resolvedSchema);
JSONAssert.assertEquals(new JSONObject(expectedOutPut), new JSONObject(resolvedSchema), JSONCompareMode.STRICT);
}
@Test
public void testResolveSchema_ExternalPathWithInValidSchema()
......
{
"$schema": "http://json-schema.org/draft-07/schema#",
"x-os-lifecycle-state": "published",
"description": "The entity well.",
"title": "Well",
"type": "object",
"definitions": {
"locationWGS84": {
"description": "The well's location as GeoJSON FeatureCollection.",
"title": "WGS84 Location",
"$ref": "https://geojson.org/schema/FeatureCollection.json",
"example": {
"features": [
{
"geometry": {
"coordinates": [
-92.11569999999999,
29.8823,
153.4779442519685
],
"type": "Point"
},
"type": "Feature",
"properties": {
"name": "Newton 2-31"
}
}
],
"type": "FeatureCollection"
}
}
},
"properties": {
"locationOriginalCRS": {
"description": "The well's original location as AnyCrsFeatureCollection - a structure similar to but distinct from GeoJSON.",
"title": "Original CRS Location",
"$ref": "os:wks:anyCrsFeatureCollection.1.0"
},
"location": {
"$ref": "#/definition/locationWGS84"
}
}
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment