From dded46d220bac1f7b95d0ed440eb3edaf77c429b Mon Sep 17 00:00:00 2001 From: Ken Stevens Date: Fri, 6 Sep 2019 10:24:19 -0400 Subject: [PATCH 1/3] fixed bug in drop fk migration task --- .../fhir/jpa/migrate/taskdef/DropForeignKeyTask.java | 10 +++++----- .../fhir/jpa/migrate/tasks/api/BaseMigrationTasks.java | 6 +++--- .../jpa/migrate/taskdef/DropForeignKeyTaskTest.java | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/DropForeignKeyTask.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/DropForeignKeyTask.java index bea3f581096..4b4c231814d 100644 --- a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/DropForeignKeyTask.java +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/taskdef/DropForeignKeyTask.java @@ -34,14 +34,14 @@ public class DropForeignKeyTask extends BaseTableTask { private static final Logger ourLog = LoggerFactory.getLogger(DropForeignKeyTask.class); private String myConstraintName; - private String myForeignTableName; + private String myParentTableName; public void setConstraintName(String theConstraintName) { myConstraintName = theConstraintName; } - public void setForeignTableName(String theForeignTableName) { - myForeignTableName = theForeignTableName; + public void setParentTableName(String theParentTableName) { + myParentTableName = theParentTableName; } @Override @@ -49,13 +49,13 @@ public class DropForeignKeyTask extends BaseTableTask { super.validate(); Validate.isTrue(isNotBlank(myConstraintName)); - Validate.isTrue(isNotBlank(myForeignTableName)); + Validate.isTrue(isNotBlank(myParentTableName)); } @Override public void execute() throws SQLException { - Set existing = JdbcUtils.getForeignKeys(getConnectionProperties(), getTableName(), myForeignTableName); + Set existing = JdbcUtils.getForeignKeys(getConnectionProperties(), myParentTableName, getTableName()); if (!existing.contains(myConstraintName)) { ourLog.info("Don't have constraint named {} - No action performed", myConstraintName); return; diff --git a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/tasks/api/BaseMigrationTasks.java b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/tasks/api/BaseMigrationTasks.java index 06faaa96c44..16d2b43f3b2 100644 --- a/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/tasks/api/BaseMigrationTasks.java +++ b/hapi-fhir-jpaserver-migrate/src/main/java/ca/uhn/fhir/jpa/migrate/tasks/api/BaseMigrationTasks.java @@ -249,13 +249,13 @@ public class BaseMigrationTasks { /** * * @param theFkName the name of the foreign key - * @param theForeignTableName the name of the table that imports the foreign key (I know it's a confusing name, but that's what java.sql.DatabaseMetaData calls it) + * @param theParentTableName the name of the table that exports the foreign key */ - public void dropForeignKey(String theFkName, String theForeignTableName) { + public void dropForeignKey(String theFkName, String theParentTableName) { DropForeignKeyTask task = new DropForeignKeyTask(); task.setConstraintName(theFkName); - task.setForeignTableName(theForeignTableName); task.setTableName(getTableName()); + task.setParentTableName(theParentTableName); addTask(task); } diff --git a/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/DropForeignKeyTaskTest.java b/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/DropForeignKeyTaskTest.java index ae6d3b17f02..dd2e0b1cc22 100644 --- a/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/DropForeignKeyTaskTest.java +++ b/hapi-fhir-jpaserver-migrate/src/test/java/ca/uhn/fhir/jpa/migrate/taskdef/DropForeignKeyTaskTest.java @@ -20,8 +20,8 @@ public class DropForeignKeyTaskTest extends BaseTest { assertThat(JdbcUtils.getForeignKeys(getConnectionProperties(), "PARENT", "CHILD"), hasSize(1)); DropForeignKeyTask task = new DropForeignKeyTask(); - task.setTableName("PARENT"); - task.setForeignTableName("CHILD"); + task.setTableName("CHILD"); + task.setParentTableName("PARENT"); task.setConstraintName("FK_MOM"); getMigrator().addTask(task); From 722c7a8211cc4aaea3734c226fafe640a4c2f1ee Mon Sep 17 00:00:00 2001 From: James Agnew Date: Fri, 6 Sep 2019 14:56:17 -0400 Subject: [PATCH 2/3] Work on GraphQL updates --- .../main/java/ca/uhn/fhir/util/TestUtil.java | 9 ++++++++ .../TermValueSetConceptDesignation.java | 2 +- ...est.java => JpaGraphQLR4ProviderTest.java} | 22 ++++++++++--------- .../dstu3/GraphQLProviderDstu3Test.java | 12 +++++----- .../provider/r4/GraphQLProviderR4Test.java | 10 +++++---- .../extractor/SearchParamExtractorR4.java | 5 +++++ .../dstu3/hapi/ctx/HapiWorkerContext.java | 12 ++++++++++ .../fhir/r4/hapi/ctx/HapiWorkerContext.java | 5 +++++ .../ca/uhn/fhir/util/GraphQLEngineTest.java | 6 +++-- .../fhir/r5/hapi/ctx/HapiWorkerContext.java | 5 +++++ .../validation/FhirInstanceValidator.java | 5 +++++ .../validation/FhirInstanceValidator.java | 5 +++++ .../validation/FhirInstanceValidator.java | 5 +++++ .../SnapshotGeneratingValidationSupport.java | 6 +++++ .../validation/FhirInstanceValidator.java | 5 +++++ .../SnapshotGeneratingValidationSupport.java | 5 +++++ pom.xml | 2 +- src/changes/changes.xml | 4 ++++ 18 files changed, 102 insertions(+), 23 deletions(-) rename hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/{GraphQLR4ProviderTest.java => JpaGraphQLR4ProviderTest.java} (93%) diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/TestUtil.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/TestUtil.java index f50033c9b29..d0c037d942a 100644 --- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/TestUtil.java +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/TestUtil.java @@ -182,4 +182,13 @@ public class TestUtil { return defaultString(theString).replace("\r", ""); } + /** + * THIS IS FOR UNIT TESTS ONLY - DO NOT CALL THIS METHOD FROM USER CODE + *

+ * Strip \r chars from a string to account for line ending platform differences + */ + public static String stripWhitespace(String theString) { + return stripReturns(theString).replace(" ", ""); + } + } diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/TermValueSetConceptDesignation.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/TermValueSetConceptDesignation.java index e3aa0c5196a..39d73528736 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/TermValueSetConceptDesignation.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/entity/TermValueSetConceptDesignation.java @@ -52,7 +52,7 @@ public class TermValueSetConceptDesignation implements Serializable { @JoinColumn(name = "VALUESET_CONCEPT_PID", referencedColumnName = "PID", nullable = false, foreignKey = @ForeignKey(name = "FK_TRM_VALUESET_CONCEPT_PID")) private TermValueSetConcept myConcept; - @ManyToOne() + @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "VALUESET_PID", referencedColumnName = "PID", nullable = false, foreignKey = @ForeignKey(name = "FK_TRM_VSCD_VS_PID")) private TermValueSet myValueSet; diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/GraphQLR4ProviderTest.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/JpaGraphQLR4ProviderTest.java similarity index 93% rename from hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/GraphQLR4ProviderTest.java rename to hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/JpaGraphQLR4ProviderTest.java index 34f09a62601..90b2b4cc184 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/GraphQLR4ProviderTest.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/JpaGraphQLR4ProviderTest.java @@ -44,9 +44,11 @@ import static org.hamcrest.Matchers.startsWith; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertThat; -public class GraphQLR4ProviderTest { +public class JpaGraphQLR4ProviderTest { - private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(GraphQLR4ProviderTest.class); + private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(JpaGraphQLR4ProviderTest.class); + public static final String DATA_PREFIX = "{\"data\": "; + public static final String DATA_SUFFIX = "}"; private static CloseableHttpClient ourClient; private static FhirContext ourCtx = FhirContext.forR4(); private static int ourPort; @@ -67,14 +69,14 @@ public class GraphQLR4ProviderTest { ourLog.info(responseContent); assertEquals(200, status.getStatusLine().getStatusCode()); - assertEquals(TestUtil.stripReturns("{\n" + + assertEquals(TestUtil.stripWhitespace(DATA_PREFIX + "{\n" + " \"name\":[{\n" + " \"family\":\"FAMILY\",\n" + " \"given\":[\"GIVEN1\",\"GIVEN2\"]\n" + " },{\n" + " \"given\":[\"GivenOnly1\",\"GivenOnly2\"]\n" + " }]\n" + - "}"), TestUtil.stripReturns(responseContent)); + "}" + DATA_SUFFIX), TestUtil.stripWhitespace(responseContent)); assertThat(status.getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue(), startsWith("application/json")); } finally { @@ -93,12 +95,12 @@ public class GraphQLR4ProviderTest { ourLog.info(responseContent); assertEquals(200, status.getStatusLine().getStatusCode()); - assertEquals(TestUtil.stripReturns("{\n" + + assertEquals(TestUtil.stripWhitespace(DATA_PREFIX + "{\n" + " \"name\":[{\n" + " \"given\":[\"GIVEN1\",\"GIVEN2\"],\n" + " \"family\":\"FAMILY\"\n" + " }]\n" + - "}"), TestUtil.stripReturns(responseContent)); + "}" + DATA_SUFFIX), TestUtil.stripWhitespace(responseContent)); assertThat(status.getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue(), startsWith("application/json")); } finally { @@ -117,7 +119,7 @@ public class GraphQLR4ProviderTest { ourLog.info(responseContent); assertEquals(200, status.getStatusLine().getStatusCode()); - assertEquals(TestUtil.stripReturns("{\n" + + assertEquals(TestUtil.stripWhitespace(DATA_PREFIX + "{\n" + " \"Patient\":{\n" + " \"name\":[{\n" + " \"given\":[\"GIVEN1\",\"GIVEN2\"],\n" + @@ -126,7 +128,7 @@ public class GraphQLR4ProviderTest { " \"given\":[\"GivenOnly1\",\"GivenOnly2\"]\n" + " }]\n" + " }\n" + - "}"), TestUtil.stripReturns(responseContent)); + "}" + DATA_SUFFIX), TestUtil.stripWhitespace(responseContent)); assertThat(status.getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue(), startsWith("application/json")); } finally { @@ -145,7 +147,7 @@ public class GraphQLR4ProviderTest { ourLog.info(responseContent); assertEquals(200, status.getStatusLine().getStatusCode()); - assertEquals(TestUtil.stripReturns("{\n" + + assertEquals(TestUtil.stripWhitespace(DATA_PREFIX + "{\n" + " \"PatientList\":[{\n" + " \"name\":[{\n" + " \"family\":\"pet\",\n" + @@ -158,7 +160,7 @@ public class GraphQLR4ProviderTest { " \"given\":[\"GivenOnlyB1\",\"GivenOnlyB2\"]\n" + " }]\n" + " }]\n" + - "}"), TestUtil.stripReturns(responseContent)); + "}" + DATA_SUFFIX), TestUtil.stripWhitespace(responseContent)); assertThat(status.getFirstHeader(Constants.HEADER_CONTENT_TYPE).getValue(), startsWith("application/json")); } finally { diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/GraphQLProviderDstu3Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/GraphQLProviderDstu3Test.java index f5cfc3c8b38..110b9a7a43b 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/GraphQLProviderDstu3Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/dstu3/GraphQLProviderDstu3Test.java @@ -5,8 +5,8 @@ import ca.uhn.fhir.util.UrlUtil; import org.apache.commons.io.IOUtils; import org.apache.http.client.methods.CloseableHttpResponse; import org.apache.http.client.methods.HttpGet; -import org.hl7.fhir.instance.model.api.IIdType; import org.hl7.fhir.dstu3.model.Patient; +import org.hl7.fhir.instance.model.api.IIdType; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -14,6 +14,8 @@ import org.slf4j.LoggerFactory; import java.io.IOException; import java.nio.charset.StandardCharsets; +import static ca.uhn.fhir.jpa.provider.JpaGraphQLR4ProviderTest.DATA_PREFIX; +import static ca.uhn.fhir.jpa.provider.JpaGraphQLR4ProviderTest.DATA_SUFFIX; import static org.junit.Assert.assertEquals; public class GraphQLProviderDstu3Test extends BaseResourceProviderDstu3Test { @@ -30,14 +32,14 @@ public class GraphQLProviderDstu3Test extends BaseResourceProviderDstu3Test { try (CloseableHttpResponse response = ourHttpClient.execute(httpGet)) { String resp = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8); ourLog.info(resp); - assertEquals(TestUtil.stripReturns("{\n" + + assertEquals(TestUtil.stripWhitespace(DATA_PREFIX +"{\n" + " \"name\":[{\n" + " \"family\":\"FAM\",\n" + " \"given\":[\"GIVEN1\",\"GIVEN2\"]\n" + " },{\n" + " \"given\":[\"GivenOnly1\",\"GivenOnly2\"]\n" + " }]\n" + - "}"), TestUtil.stripReturns(resp)); + "}" + DATA_SUFFIX), TestUtil.stripWhitespace(resp)); } } @@ -52,7 +54,7 @@ public class GraphQLProviderDstu3Test extends BaseResourceProviderDstu3Test { try (CloseableHttpResponse response = ourHttpClient.execute(httpGet)) { String resp = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8); ourLog.info(resp); - assertEquals(TestUtil.stripReturns("{\n" + + assertEquals(TestUtil.stripWhitespace(DATA_PREFIX +"{\n" + " \"PatientList\":[{\n" + " \"name\":[{\n" + " \"family\":\"FAM\",\n" + @@ -65,7 +67,7 @@ public class GraphQLProviderDstu3Test extends BaseResourceProviderDstu3Test { " \"given\":[\"GivenOnlyB1\",\"GivenOnlyB2\"]\n" + " }]\n" + " }]\n" + - "}"), TestUtil.stripReturns(resp)); + "}" + DATA_SUFFIX), TestUtil.stripWhitespace(resp)); } } diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/GraphQLProviderR4Test.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/GraphQLProviderR4Test.java index ce32e4675bb..879aa8da5e5 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/GraphQLProviderR4Test.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/provider/r4/GraphQLProviderR4Test.java @@ -14,6 +14,8 @@ import org.slf4j.LoggerFactory; import java.io.IOException; import java.nio.charset.StandardCharsets; +import static ca.uhn.fhir.jpa.provider.JpaGraphQLR4ProviderTest.DATA_PREFIX; +import static ca.uhn.fhir.jpa.provider.JpaGraphQLR4ProviderTest.DATA_SUFFIX; import static org.junit.Assert.assertEquals; public class GraphQLProviderR4Test extends BaseResourceProviderR4Test { @@ -30,14 +32,14 @@ public class GraphQLProviderR4Test extends BaseResourceProviderR4Test { try (CloseableHttpResponse response = ourHttpClient.execute(httpGet)) { String resp = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8); ourLog.info(resp); - assertEquals(TestUtil.stripReturns("{\n" + + assertEquals(TestUtil.stripWhitespace(DATA_PREFIX + "{\n" + " \"name\":[{\n" + " \"family\":\"FAM\",\n" + " \"given\":[\"GIVEN1\",\"GIVEN2\"]\n" + " },{\n" + " \"given\":[\"GivenOnly1\",\"GivenOnly2\"]\n" + " }]\n" + - "}"), TestUtil.stripReturns(resp)); + "}" + DATA_SUFFIX), TestUtil.stripWhitespace(resp)); } } @@ -52,7 +54,7 @@ public class GraphQLProviderR4Test extends BaseResourceProviderR4Test { try (CloseableHttpResponse response = ourHttpClient.execute(httpGet)) { String resp = IOUtils.toString(response.getEntity().getContent(), StandardCharsets.UTF_8); ourLog.info(resp); - assertEquals(TestUtil.stripReturns("{\n" + + assertEquals(TestUtil.stripWhitespace(DATA_PREFIX + "{\n" + " \"PatientList\":[{\n" + " \"name\":[{\n" + " \"family\":\"FAM\",\n" + @@ -65,7 +67,7 @@ public class GraphQLProviderR4Test extends BaseResourceProviderR4Test { " \"given\":[\"GivenOnlyB1\",\"GivenOnlyB2\"]\n" + " }]\n" + " }]\n" + - "}"), TestUtil.stripReturns(resp)); + "}" + DATA_SUFFIX), TestUtil.stripWhitespace(resp)); } } diff --git a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorR4.java b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorR4.java index bc80cebf659..d424d63e1b5 100644 --- a/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorR4.java +++ b/hapi-fhir-jpaserver-searchparam/src/main/java/ca/uhn/fhir/jpa/searchparam/extractor/SearchParamExtractorR4.java @@ -877,6 +877,11 @@ public class SearchParamExtractorR4 extends BaseSearchParamExtractor implements public boolean conformsToProfile(Object appContext, Base item, String url) throws FHIRException { return false; } + + @Override + public ValueSet resolveValueSet(Object appContext, String url) { + return null; + } } private static > String extractSystem(Enumeration theBoundCode) { diff --git a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/hapi/ctx/HapiWorkerContext.java b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/hapi/ctx/HapiWorkerContext.java index 3b62a3ced1b..777ba57ddda 100644 --- a/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/hapi/ctx/HapiWorkerContext.java +++ b/hapi-fhir-structures-dstu3/src/main/java/org/hl7/fhir/dstu3/hapi/ctx/HapiWorkerContext.java @@ -336,6 +336,18 @@ public final class HapiWorkerContext implements IWorkerContext, ValueSetExpander expandedValueSet = new ValueSetExpansionOutcome(expansion); } + /* + * We'll just accept all mimetypes, since this is pretty much impossible to exhaustively + * validate. + */ + if (theVs != null && "http://hl7.org/fhir/ValueSet/mimetypes".equals(theVs.getUrl())) { + ConceptDefinitionComponent definition = new ConceptDefinitionComponent(); + definition.setCode(wantCode); + definition.setDisplay(wantCode); + ValidationResult retVal = new ValidationResult(definition); + return retVal; + } + if (expandedValueSet == null) { expandedValueSet = expand(theVs, null); } diff --git a/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/hapi/ctx/HapiWorkerContext.java b/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/hapi/ctx/HapiWorkerContext.java index bd771e1c766..66f1315661b 100644 --- a/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/hapi/ctx/HapiWorkerContext.java +++ b/hapi-fhir-structures-r4/src/main/java/org/hl7/fhir/r4/hapi/ctx/HapiWorkerContext.java @@ -389,6 +389,11 @@ public final class HapiWorkerContext implements IWorkerContext, ValueSetExpander throw new UnsupportedOperationException(); } + @Override + public String getLinkForUrl(String corePath, String url) { + throw new UnsupportedOperationException(); + } + @Override public List getTypeNames() { throw new UnsupportedOperationException(); diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/util/GraphQLEngineTest.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/util/GraphQLEngineTest.java index aac66d97395..70cd2b7511f 100644 --- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/util/GraphQLEngineTest.java +++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/util/GraphQLEngineTest.java @@ -66,7 +66,8 @@ public class GraphQLEngineTest { engine.setGraphQL(Parser.parse("{valueQuantity{value,unit}}")); engine.execute(); - ObjectValue output = engine.getOutput(); + GraphQLResponse output = engine.getOutput(); + output.setWriteWrapper(false); StringBuilder outputBuilder = new StringBuilder(); output.write(outputBuilder, 0, "\n"); @@ -100,7 +101,8 @@ public class GraphQLEngineTest { engine.setServices(createStorageServices()); engine.execute(); - ObjectValue output = engine.getOutput(); + GraphQLResponse output = engine.getOutput(); + output.setWriteWrapper(false); StringBuilder outputBuilder = new StringBuilder(); output.write(outputBuilder, 0, "\n"); diff --git a/hapi-fhir-structures-r5/src/main/java/org/hl7/fhir/r5/hapi/ctx/HapiWorkerContext.java b/hapi-fhir-structures-r5/src/main/java/org/hl7/fhir/r5/hapi/ctx/HapiWorkerContext.java index a3ebec0ce7e..e49f54fbae3 100644 --- a/hapi-fhir-structures-r5/src/main/java/org/hl7/fhir/r5/hapi/ctx/HapiWorkerContext.java +++ b/hapi-fhir-structures-r5/src/main/java/org/hl7/fhir/r5/hapi/ctx/HapiWorkerContext.java @@ -438,4 +438,9 @@ public final class HapiWorkerContext implements IWorkerContext, ValueSetExpander throw new UnsupportedOperationException(); } + @Override + public String getLinkForUrl(String corePath, String url) { + throw new UnsupportedOperationException(); + } + } diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/dstu3/hapi/validation/FhirInstanceValidator.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/dstu3/hapi/validation/FhirInstanceValidator.java index 2d8b8f7a10f..5a877ccb646 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/dstu3/hapi/validation/FhirInstanceValidator.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/dstu3/hapi/validation/FhirInstanceValidator.java @@ -339,6 +339,11 @@ public class FhirInstanceValidator extends BaseValidatorBridge implements IValid throw new UnsupportedOperationException(); } + @Override + public String getLinkForUrl(String corePath, String url) { + throw new UnsupportedOperationException(); + } + @Override public void generateSnapshot(org.hl7.fhir.r5.model.StructureDefinition p) throws FHIRException { // nothing yet diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/instance/hapi/validation/FhirInstanceValidator.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/instance/hapi/validation/FhirInstanceValidator.java index c0cde8f5f37..d9ce4a1f194 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/instance/hapi/validation/FhirInstanceValidator.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/instance/hapi/validation/FhirInstanceValidator.java @@ -522,6 +522,11 @@ public class FhirInstanceValidator extends BaseValidatorBridge implements IValid } + @Override + public String getLinkForUrl(String corePath, String url) { + throw new UnsupportedOperationException(); + } + @Override public Parameters getExpansionParameters() { return myExpansionProfile; diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/r4/hapi/validation/FhirInstanceValidator.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/r4/hapi/validation/FhirInstanceValidator.java index cb29e902f41..8b24d0c9419 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/r4/hapi/validation/FhirInstanceValidator.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/r4/hapi/validation/FhirInstanceValidator.java @@ -669,6 +669,11 @@ public class FhirInstanceValidator extends org.hl7.fhir.r4.hapi.validation.BaseV return convertValidationResult(result); } + @Override + public String getLinkForUrl(String corePath, String url) { + throw new UnsupportedOperationException(); + } + } private static class ResourceKey { diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/r4/hapi/validation/SnapshotGeneratingValidationSupport.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/r4/hapi/validation/SnapshotGeneratingValidationSupport.java index f399aabfcd6..42425c3aead 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/r4/hapi/validation/SnapshotGeneratingValidationSupport.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/r4/hapi/validation/SnapshotGeneratingValidationSupport.java @@ -145,6 +145,12 @@ public class SnapshotGeneratingValidationSupport implements IValidationSupport { public boolean prependLinks() { return false; } + + @Override + public String getLinkForUrl(String corePath, String url) { + throw new UnsupportedOperationException(); + } + } } diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/r5/hapi/validation/FhirInstanceValidator.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/r5/hapi/validation/FhirInstanceValidator.java index 3c29bc5bfce..9935f8de93e 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/r5/hapi/validation/FhirInstanceValidator.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/r5/hapi/validation/FhirInstanceValidator.java @@ -282,6 +282,11 @@ public class FhirInstanceValidator extends org.hl7.fhir.r5.hapi.validation.BaseV // nothing yet } + @Override + public String getLinkForUrl(String corePath, String url) { + throw new UnsupportedOperationException(); + } + @Override public org.hl7.fhir.r5.model.Parameters getExpansionParameters() { return myExpansionProfile; diff --git a/hapi-fhir-validation/src/main/java/org/hl7/fhir/r5/hapi/validation/SnapshotGeneratingValidationSupport.java b/hapi-fhir-validation/src/main/java/org/hl7/fhir/r5/hapi/validation/SnapshotGeneratingValidationSupport.java index 856ceaca609..9403dbac522 100644 --- a/hapi-fhir-validation/src/main/java/org/hl7/fhir/r5/hapi/validation/SnapshotGeneratingValidationSupport.java +++ b/hapi-fhir-validation/src/main/java/org/hl7/fhir/r5/hapi/validation/SnapshotGeneratingValidationSupport.java @@ -131,6 +131,11 @@ public class SnapshotGeneratingValidationSupport implements IValidationSupport { return null; } + @Override + public String getLinkForUrl(String corePath, String url) { + throw new UnsupportedOperationException(); + } + @Override public BindingResolution resolveBinding(StructureDefinition def, String url, String path) throws FHIRException { return null; diff --git a/pom.xml b/pom.xml index 1e8675e2c32..1db1f35315b 100755 --- a/pom.xml +++ b/pom.xml @@ -562,7 +562,7 @@ - 4.0.2-SNAPSHOT + 4.0.8-SNAPSHOT 1.0.2 diff --git a/src/changes/changes.xml b/src/changes/changes.xml index f87492746f4..43bf8de61e8 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -113,6 +113,10 @@ the RequestValidatingInterceptor, but not including any HAPI FHIR security interceptors) could be bypassed if a Content Type was not included. + + The GraphQL provider did not wrap the respone in a "data" element as described in the FHIR + specification. This has been corrected. + From 7e419515086baa4d2fd91d2f534911b7134b6c51 Mon Sep 17 00:00:00 2001 From: James Agnew Date: Mon, 9 Sep 2019 15:02:12 -0400 Subject: [PATCH 3/3] Create utility method for accessing the reqyest detail --- .../main/java/ca/uhn/fhir/rest/server/RestfulServer.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/RestfulServer.java b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/RestfulServer.java index 7a8b442e753..5921e6ba67f 100644 --- a/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/RestfulServer.java +++ b/hapi-fhir-server/src/main/java/ca/uhn/fhir/rest/server/RestfulServer.java @@ -848,7 +848,7 @@ public class RestfulServer extends HttpServlet implements IRestfulServer