From 766f6b55ed2fca75a5b3fa314ef7770f82d73504 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Mon, 3 Jun 2019 19:38:10 +1000 Subject: [PATCH] add openAPI tests --- .../convertors/VersionConvertor_30_40.java | 2 +- .../hl7/fhir/r5/openapi/OpenApiGenerator.java | 284 +++- .../r5/utils/OperationOutcomeUtilities.java | 5 + .../hl7/fhir/r5/utils/ToolingExtensions.java | 2 + .../src/main/resources/openapi/cs-base.json | 626 ++++++++ .../src/main/resources/openapi/cs-base2.json | 45 + .../main/resources/openapi/swagger-base.json | 1269 +++++++++++++++++ .../main/resources/openapi/swagger-base2.json | 136 ++ .../java/org/hl7/fhir/r5/test/AllR5Tests.java | 1 + .../fhir/r5/test/OpenApiGeneratorTest.java | 44 + .../fhir/r5/validation/ValidationEngine.java | 21 + .../org/hl7/fhir/r5/validation/Validator.java | 1 + 12 files changed, 2411 insertions(+), 25 deletions(-) create mode 100644 org.hl7.fhir.r5/src/main/resources/openapi/cs-base.json create mode 100644 org.hl7.fhir.r5/src/main/resources/openapi/cs-base2.json create mode 100644 org.hl7.fhir.r5/src/main/resources/openapi/swagger-base.json create mode 100644 org.hl7.fhir.r5/src/main/resources/openapi/swagger-base2.json create mode 100644 org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/OpenApiGeneratorTest.java diff --git a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_30_40.java b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_30_40.java index 4475810ae..d807bbaad 100644 --- a/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_30_40.java +++ b/org.hl7.fhir.convertors/src/main/java/org/hl7/fhir/convertors/VersionConvertor_30_40.java @@ -17965,7 +17965,7 @@ public class VersionConvertor_30_40 { if (src.hasStandardSequence()) tgt.setStandardSequence(convertCodeableConcept(src.getStandardSequence())); if (src.hasStart()) - tgt.setStart(src.getStart())); + tgt.setStart(src.getStart()); if (src.hasEnd()) tgt.setEnd(src.getEnd()); if (src.hasScore()) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/openapi/OpenApiGenerator.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/openapi/OpenApiGenerator.java index ad240a0a2..11aeffcdd 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/openapi/OpenApiGenerator.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/openapi/OpenApiGenerator.java @@ -10,6 +10,8 @@ import org.hl7.fhir.r5.model.CapabilityStatement.CapabilityStatementRestResource import org.hl7.fhir.r5.model.CapabilityStatement.ResourceInteractionComponent; import org.hl7.fhir.r5.model.CapabilityStatement.ResourceVersionPolicy; import org.hl7.fhir.r5.model.CapabilityStatement.RestfulCapabilityMode; +import org.hl7.fhir.r5.model.CapabilityStatement.SystemInteractionComponent; +import org.hl7.fhir.r5.model.CapabilityStatement.SystemRestfulInteraction; import org.hl7.fhir.r5.model.CapabilityStatement.TypeRestfulInteraction; import org.hl7.fhir.r5.model.CodeType; import org.hl7.fhir.r5.model.ContactDetail; @@ -41,12 +43,12 @@ public class OpenApiGenerator { } if (source.hasPublisher()) dest.info().contact(source.getPublisher(), null, null); - + if (source.hasImplementation()) { dest.server(source.getImplementation().getUrl()).description(source.getImplementation().getDescription()); } dest.externalDocs().url(source.getUrl()).description("FHIR CapabilityStatement"); - + for (CapabilityStatementRestComponent csr : source.getRest()) { if (csr.getMode() == RestfulCapabilityMode.SERVER) { generatePaths(csr); @@ -54,37 +56,71 @@ public class OpenApiGenerator { } writeBaseParameters(dest.components()); } - + private void writeBaseParameters(ComponentsWriter components) { components.parameter("summary").name("_summary").in(ParameterLocation.query).description("Requests the server to return a designated subset of the resource").allowEmptyValue().style(ParameterStyle.matrix) - .schema().type(SchemaType.string).enums("true", "text", "data", "count", "false"); - + .schema().type(SchemaType.string).enums("true", "text", "data", "count", "false"); + components.parameter("format").name("_format").in(ParameterLocation.query).description("Specify alternative response formats by their MIME-types (when a client is unable acccess accept: header)").allowEmptyValue().style(ParameterStyle.matrix) - .schema().type(SchemaType.string).format("mime-type"); - + .schema().type(SchemaType.string).format("mime-type"); + components.parameter("pretty").name("_pretty").in(ParameterLocation.query).description("Ask for a pretty printed response for human convenience").allowEmptyValue().style(ParameterStyle.matrix) - .schema().type(SchemaType.bool); - + .schema().type(SchemaType.bool); + components.parameter("elements").name("_elements").in(ParameterLocation.query).description("Requests the server to return a collection of elements from the resource").allowEmptyValue().style(ParameterStyle.matrix).explode(false) - .schema().type(SchemaType.array).format("string"); + .schema().type(SchemaType.array).format("string"); } private void generatePaths(CapabilityStatementRestComponent csr) { + generateMetadata(); for (CapabilityStatementRestResourceComponent r : csr.getResource()) generateResource(r); + if (hasOp(csr, SystemRestfulInteraction.HISTORYSYSTEM)) + generateHistorySystem(csr); + if (hasOp(csr, SystemRestfulInteraction.SEARCHSYSTEM)) + generateSearchSystem(csr); + if (hasOp(csr, SystemRestfulInteraction.BATCH) || hasOp(csr, SystemRestfulInteraction.TRANSACTION) ) + generateBatchTransaction(csr); } - + private void generateResource(CapabilityStatementRestResourceComponent r) { if (hasOp(r, TypeRestfulInteraction.SEARCHTYPE)) generateSearch(r); if (hasOp(r, TypeRestfulInteraction.READ)) generateRead(r); - if (hasOp(r, TypeRestfulInteraction.VREAD)) - generateVRead(r); - if (hasOp(r, TypeRestfulInteraction.UPDATE)) - generateUpdate(r); if (hasOp(r, TypeRestfulInteraction.CREATE)) generateCreate(r); + if (hasOp(r, TypeRestfulInteraction.UPDATE)) + generateUpdate(r); + if (hasOp(r, TypeRestfulInteraction.PATCH)) + generatePatch(r); + if (hasOp(r, TypeRestfulInteraction.DELETE)) + generateDelete(r); + if (hasOp(r, TypeRestfulInteraction.HISTORYINSTANCE)) + generateHistoryInstance(r); + if (hasOp(r, TypeRestfulInteraction.VREAD)) + generateVRead(r); + if (hasOp(r, TypeRestfulInteraction.HISTORYTYPE)) + generateHistoryType(r); + } + + private void generateMetadata() { + OperationWriter op = makePathMetadata().operation("get"); + op.summary("Return the server's capability statement"); + op.operationId("metadata"); + opOutcome(op.responses().defaultResponse()); + ResponseObjectWriter resp = op.responses().httpResponse("200"); + resp.description("the capbility statement"); + if (isJson()) + resp.content("application/fhir+json").schemaRef(specRef()+"/fhir.json.schema#/definitions/CapabilityStatement"); + if (isXml()) + resp.content("application/fhir+xml").schemaRef(specRef()+"/CapabilityStatement.xsd"); + + // parameters - but do they apply? + op.paramRef("#/Components/parameters/format"); + op.paramRef("#/Components/parameters/pretty"); + op.paramRef("#/Components/parameters/summary"); + op.paramRef("#/Components/parameters/elements"); } private void generateRead(CapabilityStatementRestResourceComponent r) { @@ -100,7 +136,7 @@ public class OpenApiGenerator { resp.content("application/fhir+json").schemaRef(specRef()+"/fhir.json.schema#/definitions/"+r.getType()); if (isXml()) resp.content("application/fhir+xml").schemaRef(specRef()+"/"+r.getType()+".xsd"); - + // parameters: op.paramRef("#/Components/parameters/summary"); op.paramRef("#/Components/parameters/format"); @@ -110,20 +146,19 @@ public class OpenApiGenerator { private void generateSearch(CapabilityStatementRestResourceComponent r) { OperationWriter op = makePathResType(r).operation("get"); - op.summary("Search all resources based on a set of criteria"); + op.summary("Search all resources of type "+r.getType()+" based on a set of criteria"); op.operationId("search"+r.getType()); opOutcome(op.responses().defaultResponse()); ResponseObjectWriter resp = op.responses().httpResponse("200"); resp.description("the resource being returned"); - if (r.getVersioning() != ResourceVersionPolicy.NOVERSION) - resp.header("ETag").description("Version from Resource.meta.version as a weak ETag"); if (isJson()) resp.content("application/fhir+json").schemaRef(specRef()+"/fhir.json.schema#/definitions/Bundle"); if (isXml()) resp.content("application/fhir+xml").schemaRef(specRef()+"/Bundle.xsd"); - op.paramRef("#/Components/parameters/summary"); + // todo: how do we know that these apply? op.paramRef("#/Components/parameters/format"); op.paramRef("#/Components/parameters/pretty"); + op.paramRef("#/Components/parameters/summary"); op.paramRef("#/Components/parameters/elements"); for (CapabilityStatementRestResourceSearchParamComponent spc : r.getSearchParam()) { ParameterWriter p = op.parameter(spc.getName()); @@ -138,6 +173,35 @@ public class OpenApiGenerator { } } + private void generateSearchSystem(CapabilityStatementRestComponent csr) { + OperationWriter op = makePathSystem().operation("get"); + op.summary("Search all resources of all types based on a set of criteria"); + op.operationId("searchAll"); + opOutcome(op.responses().defaultResponse()); + ResponseObjectWriter resp = op.responses().httpResponse("200"); + resp.description("the resource being returned"); + if (isJson()) + resp.content("application/fhir+json").schemaRef(specRef()+"/fhir.json.schema#/definitions/Bundle"); + if (isXml()) + resp.content("application/fhir+xml").schemaRef(specRef()+"/Bundle.xsd"); + // todo: how do we know that these apply? + op.paramRef("#/Components/parameters/format"); + op.paramRef("#/Components/parameters/pretty"); + op.paramRef("#/Components/parameters/summary"); + op.paramRef("#/Components/parameters/elements"); + for (CapabilityStatementRestResourceSearchParamComponent spc : csr.getSearchParam()) { + ParameterWriter p = op.parameter(spc.getName()); + p.in(ParameterLocation.query).description(spc.getDocumentation()); + p.schema().type(getSchemaType(spc.getType())); + if (spc.hasDefinition()) { + SearchParameter sp = context.fetchResource(SearchParameter.class, spc.getDefinition()); + if (sp != null) { + p.description(sp.getDescription()); + } + } + } + } + private SchemaType getSchemaType(SearchParamType type) { switch (type) { // case COMPOSITE: @@ -152,6 +216,72 @@ public class OpenApiGenerator { return null; } + private void generateHistoryType(CapabilityStatementRestResourceComponent r) { + OperationWriter op = makePathResHistListType(r).operation("get"); + op.summary("Read the past states of the resource"); + op.operationId("histinst"+r.getType()); + opOutcome(op.responses().defaultResponse()); + ResponseObjectWriter resp = op.responses().httpResponse("200"); + resp.description("the resources being returned"); + if (isJson()) + resp.content("application/fhir+json").schemaRef(specRef()+"/fhir.json.schema#/definitions/Bundle"); + if (isXml()) + resp.content("application/fhir+xml").schemaRef(specRef()+"/Bundle.xsd"); + op.paramRef("#/Components/parameters/summary"); + op.paramRef("#/Components/parameters/format"); + op.paramRef("#/Components/parameters/pretty"); + op.paramRef("#/Components/parameters/elements"); + + op.parameter("_count").in(ParameterLocation.query).description("The maximum number of search results on a page. The server is not bound to return the number requested, but cannot return more").schema().type(SchemaType.number); + op.parameter("_since").in(ParameterLocation.query).description("Only include resource versions that were created at or after the given instant in time").schema().type(SchemaType.dateTime); + op.parameter("_at").in(ParameterLocation.query).description("Only include resource versions that were current at some point during the time period specified in the date time value (see Search notes on date searching)").schema().type(SchemaType.dateTime); + op.parameter("_list").in(ParameterLocation.query).description("Only include resource versions that are referenced in the specified list (current list references are allowed)").schema().type(SchemaType.string); + } + + private void generateHistoryInstance(CapabilityStatementRestResourceComponent r) { + OperationWriter op = makePathResHistListId(r).operation("get"); + op.summary("Read the past states of the resource"); + op.operationId("histinst"+r.getType()); + opOutcome(op.responses().defaultResponse()); + ResponseObjectWriter resp = op.responses().httpResponse("200"); + resp.description("the resources being returned"); + if (isJson()) + resp.content("application/fhir+json").schemaRef(specRef()+"/fhir.json.schema#/definitions/Bundle"); + if (isXml()) + resp.content("application/fhir+xml").schemaRef(specRef()+"/Bundle.xsd"); + op.paramRef("#/Components/parameters/summary"); + op.paramRef("#/Components/parameters/format"); + op.paramRef("#/Components/parameters/pretty"); + op.paramRef("#/Components/parameters/elements"); + + op.parameter("_count").in(ParameterLocation.query).description("The maximum number of search results on a page. The server is not bound to return the number requested, but cannot return more").schema().type(SchemaType.number); + op.parameter("_since").in(ParameterLocation.query).description("Only include resource versions that were created at or after the given instant in time").schema().type(SchemaType.dateTime); + op.parameter("_at").in(ParameterLocation.query).description("Only include resource versions that were current at some point during the time period specified in the date time value (see Search notes on date searching)").schema().type(SchemaType.dateTime); + op.parameter("_list").in(ParameterLocation.query).description("Only include resource versions that are referenced in the specified list (current list references are allowed)").schema().type(SchemaType.string); + } + + private void generateHistorySystem(CapabilityStatementRestComponent csr) { + OperationWriter op = makePathHistListSystem().operation("get"); + op.summary("Read the past states of all resources"); + op.operationId("histinstAll"); + opOutcome(op.responses().defaultResponse()); + ResponseObjectWriter resp = op.responses().httpResponse("200"); + resp.description("the resources being returned"); + if (isJson()) + resp.content("application/fhir+json").schemaRef(specRef()+"/fhir.json.schema#/definitions/Bundle"); + if (isXml()) + resp.content("application/fhir+xml").schemaRef(specRef()+"/Bundle.xsd"); + op.paramRef("#/Components/parameters/summary"); + op.paramRef("#/Components/parameters/format"); + op.paramRef("#/Components/parameters/pretty"); + op.paramRef("#/Components/parameters/elements"); + + op.parameter("_count").in(ParameterLocation.query).description("The maximum number of search results on a page. The server is not bound to return the number requested, but cannot return more").schema().type(SchemaType.number); + op.parameter("_since").in(ParameterLocation.query).description("Only include resource versions that were created at or after the given instant in time").schema().type(SchemaType.dateTime); + op.parameter("_at").in(ParameterLocation.query).description("Only include resource versions that were current at some point during the time period specified in the date time value (see Search notes on date searching)").schema().type(SchemaType.dateTime); + op.parameter("_list").in(ParameterLocation.query).description("Only include resource versions that are referenced in the specified list (current list references are allowed)").schema().type(SchemaType.string); + } + private void generateVRead(CapabilityStatementRestResourceComponent r) { OperationWriter op = makePathResHistId(r).operation("get"); op.summary("Read a past state of the resource"); @@ -185,7 +315,7 @@ public class OpenApiGenerator { req.content("application/fhir+json").schemaRef(specRef()+"/fhir.json.schema#/definitions/"+r.getType()); if (isXml()) req.content("application/fhir+xml").schemaRef(specRef()+"/"+r.getType()+".xsd"); - + opOutcome(op.responses().defaultResponse()); ResponseObjectWriter resp = op.responses().httpResponse("200"); resp.description("the resource being returned after being updated"); @@ -201,6 +331,47 @@ public class OpenApiGenerator { op.paramRef("#/Components/parameters/elements"); } + private void generatePatch(CapabilityStatementRestResourceComponent r) { + OperationWriter op = makePathResId(r).operation("patch"); + op.summary("Change the current state of the resource by providing a patch - a series of change commands"); + op.operationId("patch"+r.getType()); + RequestBodyWriter req = op.request(); + req.description("The new state of the resource").required(true); + if (isJson()) { + req.content("application/json-patch+json").schemaRef(specRef()+"/fhir.json.schema#/definitions/"+r.getType()); + req.content("application/fhir+json").schemaRef(specRef()+"/fhir.json.schema#/definitions/Parameters"); + } + if (isXml()) { + req.content("application/xml-patch+xml").schemaRef(specRef()+"/"+r.getType()+".xsd"); + req.content("application/fhir+xml").schemaRef(specRef()+"/Parameters.xsd"); + } + + opOutcome(op.responses().defaultResponse()); + ResponseObjectWriter resp = op.responses().httpResponse("200"); + resp.description("the resource being returned after being patched"); + if (r.getVersioning() != ResourceVersionPolicy.NOVERSION) + resp.header("ETag").description("Version from Resource.meta.version as a weak ETag"); + if (isJson()) + resp.content("application/fhir+json").schemaRef(specRef()+"/fhir.json.schema#/definitions/"+r.getType()); + if (isXml()) + resp.content("application/fhir+xml").schemaRef(specRef()+"/"+r.getType()+".xsd"); + op.paramRef("#/Components/parameters/summary"); + op.paramRef("#/Components/parameters/format"); + op.paramRef("#/Components/parameters/pretty"); + op.paramRef("#/Components/parameters/elements"); + } + + private void generateDelete(CapabilityStatementRestResourceComponent r) { + OperationWriter op = makePathResId(r).operation("delete"); + op.summary("Delete the resource so that it no exists (no read, search etc)"); + op.operationId("delete"+r.getType()); + opOutcome(op.responses().defaultResponse()); + ResponseObjectWriter resp = op.responses().httpResponse("204"); + resp.description("If the resource is deleted - no content is returned"); + if (r.getVersioning() != ResourceVersionPolicy.NOVERSION) + resp.header("ETag").description("Version from Resource.meta.version as a weak ETag"); + } + private void generateCreate(CapabilityStatementRestResourceComponent r) { OperationWriter op = makePathRes(r).operation("put"); op.summary("Create a new resource"); @@ -211,7 +382,7 @@ public class OpenApiGenerator { req.content("application/fhir+json").schemaRef(specRef()+"/fhir.json.schema#/definitions/"+r.getType()); if (isXml()) req.content("application/fhir+xml").schemaRef(specRef()+"/"+r.getType()+".xsd"); - + opOutcome(op.responses().defaultResponse()); ResponseObjectWriter resp = op.responses().httpResponse("200"); resp.description("the resource being returned after being updated"); @@ -227,6 +398,28 @@ public class OpenApiGenerator { op.paramRef("#/Components/parameters/elements"); } + private void generateBatchTransaction(CapabilityStatementRestComponent csr) { + OperationWriter op = makePathSystem().operation("post"); + op.summary("Batch or Transaction"); + op.operationId("transaction"); + RequestBodyWriter req = op.request(); + req.description("The batch or transaction").required(true); + if (isJson()) + req.content("application/fhir+json").schemaRef(specRef()+"/fhir.json.schema#/definitions/Bundle"); + if (isXml()) + req.content("application/fhir+xml").schemaRef(specRef()+"/Bundle.xsd"); + + opOutcome(op.responses().defaultResponse()); + ResponseObjectWriter resp = op.responses().httpResponse("200"); + resp.description("Batch or Transaction response"); + if (isJson()) + resp.content("application/fhir+json").schemaRef(specRef()+"/fhir.json.schema#/definitions/Bundle"); + if (isXml()) + resp.content("application/fhir+xml").schemaRef(specRef()+"/Bundle.xsd"); + op.paramRef("#/Components/parameters/format"); + op.paramRef("#/Components/parameters/pretty"); + } + private void opOutcome(ResponseObjectWriter resp) { resp.description("Error, with details"); if (isJson()) @@ -256,6 +449,20 @@ public class OpenApiGenerator { return false; } + public PathItemWriter makePathSystem() { + PathItemWriter p = dest.path("/"); + p.summary("System level operations"); + p.description("System level operations"); + return p; + } + + public PathItemWriter makePathMetadata() { + PathItemWriter p = dest.path("/metadata"); + p.summary("Access to the Server's Capability Statement"); + p.description("All FHIR Servers return a CapabilityStatement that describes what services they perform"); + return p; + } + public PathItemWriter makePathRes(CapabilityStatementRestResourceComponent r) { PathItemWriter p = dest.path("/"+r.getType()); p.summary("Manager for resources of type "+r.getType()); @@ -277,13 +484,42 @@ public class OpenApiGenerator { return p; } - public PathItemWriter makePathResHistId(CapabilityStatementRestResourceComponent r) { - PathItemWriter p = dest.path("/"+r.getType()+"/{rid}/_history/{hid}"); + public PathItemWriter makePathResHistListType(CapabilityStatementRestResourceComponent r) { + PathItemWriter p = dest.path("/"+r.getType()+"/_history"); + p.summary("Read past versions of resources of type "+r.getType()); + p.description("Access to previous versions of resourcez of type "+r.getType()); + return p; + } + + public PathItemWriter makePathResHistListId(CapabilityStatementRestResourceComponent r) { + PathItemWriter p = dest.path("/"+r.getType()+"/{rid}/_history"); p.summary("Read past versions of resource instance of type "+r.getType()); p.description("Access to previous versions of a single resource of type "+r.getType()); return p; } + public PathItemWriter makePathResHistId(CapabilityStatementRestResourceComponent r) { + PathItemWriter p = dest.path("/"+r.getType()+"/{rid}/_history/{hid}"); + p.summary("Read a past version of resource instance of type "+r.getType()); + p.description("Access a to specified previous version of a single resource of type "+r.getType()); + return p; + } + + public PathItemWriter makePathHistListSystem() { + PathItemWriter p = dest.path("/_history"); + p.summary("Read a past version of resource instance of all types"); + p.description("Access a previous versions of all types"); + return p; + } + + private boolean hasOp(CapabilityStatementRestComponent r, SystemRestfulInteraction opCode) { + for (SystemInteractionComponent op : r.getInteraction()) { + if (op.getCode() == opCode) + return true; + } + return false; + } + private boolean hasOp(CapabilityStatementRestResourceComponent r, TypeRestfulInteraction opCode) { for (ResourceInteractionComponent op : r.getInteraction()) { if (op.getCode() == opCode) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/OperationOutcomeUtilities.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/OperationOutcomeUtilities.java index d7cc9818b..ac4b491b0 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/OperationOutcomeUtilities.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/OperationOutcomeUtilities.java @@ -22,6 +22,7 @@ package org.hl7.fhir.r5.utils; import org.hl7.fhir.r5.model.CodeableConcept; +import org.hl7.fhir.r5.model.IntegerType; import org.hl7.fhir.r5.model.OperationOutcome; import org.hl7.fhir.r5.model.OperationOutcome.IssueSeverity; import org.hl7.fhir.r5.model.OperationOutcome.IssueType; @@ -40,6 +41,10 @@ public class OperationOutcomeUtilities { s.setValue(message.getLocation()+(message.getLine()>= 0 && message.getCol() >= 0 ? " (line "+Integer.toString(message.getLine())+", col"+Integer.toString(message.getCol())+")" : "") ); issue.getLocation().add(s); } + if (message.getLine() != 0) + issue.addExtension().setUrl(ToolingExtensions.EXT_ISSUE_LINE).setValue(new IntegerType(message.getLine())); + if (message.getCol() != 0) + issue.addExtension().setUrl(ToolingExtensions.EXT_ISSUE_COL).setValue(new IntegerType(message.getCol())); issue.setSeverity(convert(message.getLevel())); CodeableConcept c = new CodeableConcept(); c.setText(message.getMessage()); diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/ToolingExtensions.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/ToolingExtensions.java index 7b041a4f1..4b902b22d 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/ToolingExtensions.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/utils/ToolingExtensions.java @@ -97,6 +97,8 @@ public class ToolingExtensions { private static final String EXT_IDENTIFIER = "http://hl7.org/fhir/StructureDefinition/identifier"; public static final String EXT_TRANSLATION = "http://hl7.org/fhir/StructureDefinition/translation"; public static final String EXT_ISSUE_SOURCE = "http://hl7.org/fhir/StructureDefinition/operationoutcome-issue-source"; + public static final String EXT_ISSUE_LINE = "http://hl7.org/fhir/StructureDefinition/operationoutcome-issue-line"; + public static final String EXT_ISSUE_COL = "http://hl7.org/fhir/StructureDefinition/operationoutcome-issue-col"; public static final String EXT_DISPLAY_HINT = "http://hl7.org/fhir/StructureDefinition/structuredefinition-display-hint"; public static final String EXT_REPLACED_BY = "http://hl7.org/fhir/StructureDefinition/valueset-replacedby"; public static final String EXT_JSON_TYPE = "http://hl7.org/fhir/StructureDefinition/structuredefinition-json-type"; diff --git a/org.hl7.fhir.r5/src/main/resources/openapi/cs-base.json b/org.hl7.fhir.r5/src/main/resources/openapi/cs-base.json new file mode 100644 index 000000000..1fbd8bc6e --- /dev/null +++ b/org.hl7.fhir.r5/src/main/resources/openapi/cs-base.json @@ -0,0 +1,626 @@ +{ + "resourceType" : "CapabilityStatement", + "id" : "base", + "text" : { + "status" : "generated", + "div" : "

Base FHIR Capability Statement (Full)

This is the base Capability Statement for FHIR. It represents a server that provides the full set of functionality defined by FHIR. It is provided to use as a template for system designers to build their own Capability Statements from

\n
ModeSERVER
DescriptionAll the functionality defined in FHIR
Transactiony
System Historyy
System Searchy
Resource TypeProfileReadV-ReadSearchUpdateCreateDeleteUpdatesHistory
Accounthttp://hl7.org/fhir/StructureDefinition/Accountyyyyyyyy
ActivityDefinitionhttp://hl7.org/fhir/StructureDefinition/ActivityDefinitionyyyyyyyy
AdverseEventhttp://hl7.org/fhir/StructureDefinition/AdverseEventyyyyyyyy
AllergyIntolerancehttp://hl7.org/fhir/StructureDefinition/AllergyIntoleranceyyyyyyyy
Appointmenthttp://hl7.org/fhir/StructureDefinition/Appointmentyyyyyyyy
AppointmentResponsehttp://hl7.org/fhir/StructureDefinition/AppointmentResponseyyyyyyyy
AuditEventhttp://hl7.org/fhir/StructureDefinition/AuditEventyyyyyyyy
Basichttp://hl7.org/fhir/StructureDefinition/Basicyyyyyyyy
Binaryhttp://hl7.org/fhir/StructureDefinition/Binaryyyyyyyyy
BiologicallyDerivedProducthttp://hl7.org/fhir/StructureDefinition/BiologicallyDerivedProductyyyyyyyy
BodyStructurehttp://hl7.org/fhir/StructureDefinition/BodyStructureyyyyyyyy
Bundlehttp://hl7.org/fhir/StructureDefinition/Bundleyyyyyyyy
CapabilityStatementhttp://hl7.org/fhir/StructureDefinition/CapabilityStatementyyyyyyyy
CapabilityStatement2http://hl7.org/fhir/StructureDefinition/CapabilityStatement2yyyyyyyy
CarePlanhttp://hl7.org/fhir/StructureDefinition/CarePlanyyyyyyyy
CareTeamhttp://hl7.org/fhir/StructureDefinition/CareTeamyyyyyyyy
CatalogEntryhttp://hl7.org/fhir/StructureDefinition/CatalogEntryyyyyyyyy
ChargeItemhttp://hl7.org/fhir/StructureDefinition/ChargeItemyyyyyyyy
ChargeItemDefinitionhttp://hl7.org/fhir/StructureDefinition/ChargeItemDefinitionyyyyyyyy
Claimhttp://hl7.org/fhir/StructureDefinition/Claimyyyyyyyy
ClaimResponsehttp://hl7.org/fhir/StructureDefinition/ClaimResponseyyyyyyyy
ClinicalImpressionhttp://hl7.org/fhir/StructureDefinition/ClinicalImpressionyyyyyyyy
ClinicalUseIssuehttp://hl7.org/fhir/StructureDefinition/ClinicalUseIssueyyyyyyyy
CodeSystemhttp://hl7.org/fhir/StructureDefinition/CodeSystemyyyyyyyy
Communicationhttp://hl7.org/fhir/StructureDefinition/Communicationyyyyyyyy
CommunicationRequesthttp://hl7.org/fhir/StructureDefinition/CommunicationRequestyyyyyyyy
CompartmentDefinitionhttp://hl7.org/fhir/StructureDefinition/CompartmentDefinitionyyyyyyyy
Compositionhttp://hl7.org/fhir/StructureDefinition/Compositionyyyyyyyy
ConceptMaphttp://hl7.org/fhir/StructureDefinition/ConceptMapyyyyyyyy
Conditionhttp://hl7.org/fhir/StructureDefinition/Conditionyyyyyyyy
ConditionDefinitionhttp://hl7.org/fhir/StructureDefinition/ConditionDefinitionyyyyyyyy
Consenthttp://hl7.org/fhir/StructureDefinition/Consentyyyyyyyy
Contracthttp://hl7.org/fhir/StructureDefinition/Contractyyyyyyyy
Coveragehttp://hl7.org/fhir/StructureDefinition/Coverageyyyyyyyy
CoverageEligibilityRequesthttp://hl7.org/fhir/StructureDefinition/CoverageEligibilityRequestyyyyyyyy
CoverageEligibilityResponsehttp://hl7.org/fhir/StructureDefinition/CoverageEligibilityResponseyyyyyyyy
DetectedIssuehttp://hl7.org/fhir/StructureDefinition/DetectedIssueyyyyyyyy
Devicehttp://hl7.org/fhir/StructureDefinition/Deviceyyyyyyyy
DeviceDefinitionhttp://hl7.org/fhir/StructureDefinition/DeviceDefinitionyyyyyyyy
DeviceMetrichttp://hl7.org/fhir/StructureDefinition/DeviceMetricyyyyyyyy
DeviceRequesthttp://hl7.org/fhir/StructureDefinition/DeviceRequestyyyyyyyy
DeviceUseStatementhttp://hl7.org/fhir/StructureDefinition/DeviceUseStatementyyyyyyyy
DiagnosticReporthttp://hl7.org/fhir/StructureDefinition/DiagnosticReportyyyyyyyy
DocumentManifesthttp://hl7.org/fhir/StructureDefinition/DocumentManifestyyyyyyyy
DocumentReferencehttp://hl7.org/fhir/StructureDefinition/DocumentReferenceyyyyyyyy
EffectEvidenceSynthesishttp://hl7.org/fhir/StructureDefinition/EffectEvidenceSynthesisyyyyyyyy
Encounterhttp://hl7.org/fhir/StructureDefinition/Encounteryyyyyyyy
Endpointhttp://hl7.org/fhir/StructureDefinition/Endpointyyyyyyyy
EnrollmentRequesthttp://hl7.org/fhir/StructureDefinition/EnrollmentRequestyyyyyyyy
EnrollmentResponsehttp://hl7.org/fhir/StructureDefinition/EnrollmentResponseyyyyyyyy
EpisodeOfCarehttp://hl7.org/fhir/StructureDefinition/EpisodeOfCareyyyyyyyy
EventDefinitionhttp://hl7.org/fhir/StructureDefinition/EventDefinitionyyyyyyyy
Evidencehttp://hl7.org/fhir/StructureDefinition/Evidenceyyyyyyyy
EvidenceVariablehttp://hl7.org/fhir/StructureDefinition/EvidenceVariableyyyyyyyy
ExampleScenariohttp://hl7.org/fhir/StructureDefinition/ExampleScenarioyyyyyyyy
ExplanationOfBenefithttp://hl7.org/fhir/StructureDefinition/ExplanationOfBenefityyyyyyyy
FamilyMemberHistoryhttp://hl7.org/fhir/StructureDefinition/FamilyMemberHistoryyyyyyyyy
Flaghttp://hl7.org/fhir/StructureDefinition/Flagyyyyyyyy
Goalhttp://hl7.org/fhir/StructureDefinition/Goalyyyyyyyy
GraphDefinitionhttp://hl7.org/fhir/StructureDefinition/GraphDefinitionyyyyyyyy
Grouphttp://hl7.org/fhir/StructureDefinition/Groupyyyyyyyy
GuidanceResponsehttp://hl7.org/fhir/StructureDefinition/GuidanceResponseyyyyyyyy
HealthcareServicehttp://hl7.org/fhir/StructureDefinition/HealthcareServiceyyyyyyyy
ImagingStudyhttp://hl7.org/fhir/StructureDefinition/ImagingStudyyyyyyyyy
Immunizationhttp://hl7.org/fhir/StructureDefinition/Immunizationyyyyyyyy
ImmunizationEvaluationhttp://hl7.org/fhir/StructureDefinition/ImmunizationEvaluationyyyyyyyy
ImmunizationRecommendationhttp://hl7.org/fhir/StructureDefinition/ImmunizationRecommendationyyyyyyyy
ImplementationGuidehttp://hl7.org/fhir/StructureDefinition/ImplementationGuideyyyyyyyy
Ingredienthttp://hl7.org/fhir/StructureDefinition/Ingredientyyyyyyyy
InsurancePlanhttp://hl7.org/fhir/StructureDefinition/InsurancePlanyyyyyyyy
Invoicehttp://hl7.org/fhir/StructureDefinition/Invoiceyyyyyyyy
Libraryhttp://hl7.org/fhir/StructureDefinition/Libraryyyyyyyyy
Linkagehttp://hl7.org/fhir/StructureDefinition/Linkageyyyyyyyy
Listhttp://hl7.org/fhir/StructureDefinition/Listyyyyyyyy
Locationhttp://hl7.org/fhir/StructureDefinition/Locationyyyyyyyy
Measurehttp://hl7.org/fhir/StructureDefinition/Measureyyyyyyyy
MeasureReporthttp://hl7.org/fhir/StructureDefinition/MeasureReportyyyyyyyy
Mediahttp://hl7.org/fhir/StructureDefinition/Mediayyyyyyyy
Medicationhttp://hl7.org/fhir/StructureDefinition/Medicationyyyyyyyy
MedicationAdministrationhttp://hl7.org/fhir/StructureDefinition/MedicationAdministrationyyyyyyyy
MedicationDispensehttp://hl7.org/fhir/StructureDefinition/MedicationDispenseyyyyyyyy
MedicationKnowledgehttp://hl7.org/fhir/StructureDefinition/MedicationKnowledgeyyyyyyyy
MedicationRequesthttp://hl7.org/fhir/StructureDefinition/MedicationRequestyyyyyyyy
MedicationUsagehttp://hl7.org/fhir/StructureDefinition/MedicationUsageyyyyyyyy
MessageDefinitionhttp://hl7.org/fhir/StructureDefinition/MessageDefinitionyyyyyyyy
MessageHeaderhttp://hl7.org/fhir/StructureDefinition/MessageHeaderyyyyyyyy
MolecularSequencehttp://hl7.org/fhir/StructureDefinition/MolecularSequenceyyyyyyyy
NamingSystemhttp://hl7.org/fhir/StructureDefinition/NamingSystemyyyyyyyy
NutritionOrderhttp://hl7.org/fhir/StructureDefinition/NutritionOrderyyyyyyyy
Observationhttp://hl7.org/fhir/StructureDefinition/Observationyyyyyyyy
ObservationDefinitionhttp://hl7.org/fhir/StructureDefinition/ObservationDefinitionyyyyyyyy
OperationDefinitionhttp://hl7.org/fhir/StructureDefinition/OperationDefinitionyyyyyyyy
OperationOutcomehttp://hl7.org/fhir/StructureDefinition/OperationOutcomeyyyyyyyy
Organizationhttp://hl7.org/fhir/StructureDefinition/Organizationyyyyyyyy
OrganizationAffiliationhttp://hl7.org/fhir/StructureDefinition/OrganizationAffiliationyyyyyyyy
Patienthttp://hl7.org/fhir/StructureDefinition/Patientyyyyyyyy
PaymentNoticehttp://hl7.org/fhir/StructureDefinition/PaymentNoticeyyyyyyyy
PaymentReconciliationhttp://hl7.org/fhir/StructureDefinition/PaymentReconciliationyyyyyyyy
Personhttp://hl7.org/fhir/StructureDefinition/Personyyyyyyyy
PlanDefinitionhttp://hl7.org/fhir/StructureDefinition/PlanDefinitionyyyyyyyy
Practitionerhttp://hl7.org/fhir/StructureDefinition/Practitioneryyyyyyyy
PractitionerRolehttp://hl7.org/fhir/StructureDefinition/PractitionerRoleyyyyyyyy
Procedurehttp://hl7.org/fhir/StructureDefinition/Procedureyyyyyyyy
Provenancehttp://hl7.org/fhir/StructureDefinition/Provenanceyyyyyyyy
Questionnairehttp://hl7.org/fhir/StructureDefinition/Questionnaireyyyyyyyy
QuestionnaireResponsehttp://hl7.org/fhir/StructureDefinition/QuestionnaireResponseyyyyyyyy
RegulatedAdministrableProducthttp://hl7.org/fhir/StructureDefinition/RegulatedAdministrableProductyyyyyyyy
RegulatedAuthorizationhttp://hl7.org/fhir/StructureDefinition/RegulatedAuthorizationyyyyyyyy
RegulatedManufacturedItemhttp://hl7.org/fhir/StructureDefinition/RegulatedManufacturedItemyyyyyyyy
RegulatedMedicinalProducthttp://hl7.org/fhir/StructureDefinition/RegulatedMedicinalProductyyyyyyyy
RegulatedPackagedProducthttp://hl7.org/fhir/StructureDefinition/RegulatedPackagedProductyyyyyyyy
RelatedPersonhttp://hl7.org/fhir/StructureDefinition/RelatedPersonyyyyyyyy
RequestGrouphttp://hl7.org/fhir/StructureDefinition/RequestGroupyyyyyyyy
ResearchDefinitionhttp://hl7.org/fhir/StructureDefinition/ResearchDefinitionyyyyyyyy
ResearchElementDefinitionhttp://hl7.org/fhir/StructureDefinition/ResearchElementDefinitionyyyyyyyy
ResearchStudyhttp://hl7.org/fhir/StructureDefinition/ResearchStudyyyyyyyyy
ResearchSubjecthttp://hl7.org/fhir/StructureDefinition/ResearchSubjectyyyyyyyy
RiskAssessmenthttp://hl7.org/fhir/StructureDefinition/RiskAssessmentyyyyyyyy
RiskEvidenceSynthesishttp://hl7.org/fhir/StructureDefinition/RiskEvidenceSynthesisyyyyyyyy
Schedulehttp://hl7.org/fhir/StructureDefinition/Scheduleyyyyyyyy
SearchParameterhttp://hl7.org/fhir/StructureDefinition/SearchParameteryyyyyyyy
ServiceRequesthttp://hl7.org/fhir/StructureDefinition/ServiceRequestyyyyyyyy
Slothttp://hl7.org/fhir/StructureDefinition/Slotyyyyyyyy
Specimenhttp://hl7.org/fhir/StructureDefinition/Specimenyyyyyyyy
SpecimenDefinitionhttp://hl7.org/fhir/StructureDefinition/SpecimenDefinitionyyyyyyyy
Statistichttp://hl7.org/fhir/StructureDefinition/Statisticyyyyyyyy
StructureDefinitionhttp://hl7.org/fhir/StructureDefinition/StructureDefinitionyyyyyyyy
StructureMaphttp://hl7.org/fhir/StructureDefinition/StructureMapyyyyyyyy
Subscriptionhttp://hl7.org/fhir/StructureDefinition/Subscriptionyyyyyyyy
Substancehttp://hl7.org/fhir/StructureDefinition/Substanceyyyyyyyy
SubstanceDefinitionhttp://hl7.org/fhir/StructureDefinition/SubstanceDefinitionyyyyyyyy
SubstanceNucleicAcidhttp://hl7.org/fhir/StructureDefinition/SubstanceNucleicAcidyyyyyyyy
SubstancePolymerhttp://hl7.org/fhir/StructureDefinition/SubstancePolymeryyyyyyyy
SubstanceProteinhttp://hl7.org/fhir/StructureDefinition/SubstanceProteinyyyyyyyy
SubstanceReferenceInformationhttp://hl7.org/fhir/StructureDefinition/SubstanceReferenceInformationyyyyyyyy
SubstanceSourceMaterialhttp://hl7.org/fhir/StructureDefinition/SubstanceSourceMaterialyyyyyyyy
SupplyDeliveryhttp://hl7.org/fhir/StructureDefinition/SupplyDeliveryyyyyyyyy
SupplyRequesthttp://hl7.org/fhir/StructureDefinition/SupplyRequestyyyyyyyy
Taskhttp://hl7.org/fhir/StructureDefinition/Taskyyyyyyyy
TerminologyCapabilitieshttp://hl7.org/fhir/StructureDefinition/TerminologyCapabilitiesyyyyyyyy
TestReporthttp://hl7.org/fhir/StructureDefinition/TestReportyyyyyyyy
TestScripthttp://hl7.org/fhir/StructureDefinition/TestScriptyyyyyyyy
ValueSethttp://hl7.org/fhir/StructureDefinition/ValueSetyyyyyyyy
VerificationResulthttp://hl7.org/fhir/StructureDefinition/VerificationResultyyyyyyyy
VisionPrescriptionhttp://hl7.org/fhir/StructureDefinition/VisionPrescriptionyyyyyyyy
" + }, + "url" : "http://hl7.org/fhir/CapabilityStatement/base", + "version" : "4.1.0", + "name" : "Base FHIR Capability Statement (Full)", + "status" : "draft", + "experimental" : true, + "date" : "2019-06-01T11:22:02+10:00", + "publisher" : "FHIR Project Team", + "contact" : [{ + "telecom" : [{ + "system" : "url", + "value" : "http://hl7.org/fhir" + }] + }], + "description" : "This is the base Capability Statement for FHIR. It represents a server that provides the full set of functionality defined by FHIR. It is provided to use as a template for system designers to build their own Capability Statements from", + "kind" : "capability", + "software" : { + "name" : "Insert your software name here..." + }, + "fhirVersion" : "4.1.0", + "format" : ["xml", + "json"], + "rest" : [{ + "mode" : "server", + "documentation" : "All the functionality defined in FHIR", + "security" : { + "cors" : true, + "service" : [{ + "coding" : [{ + "system" : "http://terminology.hl7.org/CodeSystem/restful-security-service", + "code" : "SMART-on-FHIR", + "display" : "SMART-on-FHIR" + }], + "text" : "See http://docs.smarthealthit.org/" + }], + "description" : "This is the Capability Statement to declare that the server supports SMART-on-FHIR. See the SMART-on-FHIR docs for the extension that would go with such a server" + }, + "resource" : [{ + "type" : "Account", + "profile" : "http://hl7.org/fhir/StructureDefinition/Account", + "interaction" : [{ + "code" : "read", + "documentation" : "Implemented per the specification (or Insert other doco here)" + }, + { + "code" : "vread", + "documentation" : "Implemented per the specification (or Insert other doco here)" + }, + { + "code" : "update", + "documentation" : "Implemented per the specification (or Insert other doco here)" + }, + { + "code" : "delete", + "documentation" : "Implemented per the specification (or Insert other doco here)" + }, + { + "code" : "history-instance", + "documentation" : "Implemented per the specification (or Insert other doco here)" + }, + { + "code" : "history-type", + "documentation" : "Implemented per the specification (or Insert other doco here)" + }, + { + "code" : "create", + "documentation" : "Implemented per the specification (or Insert other doco here)" + }, + { + "code" : "search-type", + "documentation" : "Implemented per the specification (or Insert other doco here)" + }], + "conditionalCreate" : true, + "conditionalUpdate" : true, + "conditionalDelete" : "multiple", + "referencePolicy" : ["literal", + "logical"], + "searchInclude" : ["Account.owner", + "Account.subject", + "Account.patient"], + "searchRevInclude" : ["ChargeItem.account", + "Encounter.account", + "Invoice.account"], + "searchParam" : [{ + "name" : "owner", + "definition" : "http://hl7.org/fhir/SearchParameter/Account-owner", + "type" : "reference", + "documentation" : "Entity managing the Account" + }, + { + "name" : "identifier", + "definition" : "http://hl7.org/fhir/SearchParameter/Account-identifier", + "type" : "token", + "documentation" : "Account number" + }, + { + "name" : "period", + "definition" : "http://hl7.org/fhir/SearchParameter/Account-period", + "type" : "date", + "documentation" : "Transaction window" + }, + { + "name" : "subject", + "definition" : "http://hl7.org/fhir/SearchParameter/Account-subject", + "type" : "reference", + "documentation" : "The entity that caused the expenses" + }, + { + "name" : "patient", + "definition" : "http://hl7.org/fhir/SearchParameter/Account-patient", + "type" : "reference", + "documentation" : "The entity that caused the expenses" + }, + { + "name" : "name", + "definition" : "http://hl7.org/fhir/SearchParameter/Account-name", + "type" : "string", + "documentation" : "Human-readable label" + }, + { + "name" : "type", + "definition" : "http://hl7.org/fhir/SearchParameter/Account-type", + "type" : "token", + "documentation" : "E.g. patient, expense, depreciation" + }, + { + "name" : "status", + "definition" : "http://hl7.org/fhir/SearchParameter/Account-status", + "type" : "token", + "documentation" : "active | inactive | entered-in-error | on-hold | unknown" + }] + }], + "interaction" : [{ + "code" : "transaction", + "documentation" : "Implemented per the specification (or Insert other doco here)" + }, + { + "code" : "batch", + "documentation" : "Implemented per the specification (or Insert other doco here)" + }, + { + "code" : "history-system", + "documentation" : "Implemented per the specification (or Insert other doco here)" + }, + { + "code" : "search-system", + "documentation" : "Implemented per the specification (or Insert other doco here)" + }], + "searchParam" : [{ + "name" : "_text", + "definition" : "http://hl7.org/fhir/SearchParameter/DomainResource-text", + "type" : "string", + "documentation" : "Search on the narrative of the resource" + }, + { + "name" : "something", + "definition" : "http://hl7.org/fhir/SearchParameter/id", + "type" : "string", + "documentation" : "some doco" + }, + { + "name" : "_list", + "definition" : "http://hl7.org/fhir/SearchParameter/Resource-list", + "type" : "token", + "documentation" : "Retrieval of resources that are referenced by a List resource" + }, + { + "name" : "_has", + "definition" : "http://hl7.org/fhir/SearchParameter/Resource-has", + "type" : "composite", + "documentation" : "Provides support for reverse chaining" + }, + { + "name" : "_type", + "definition" : "http://hl7.org/fhir/SearchParameter/Resource-type", + "type" : "token", + "documentation" : "Type of resource (when doing cross-resource search" + }, + { + "name" : "_sort", + "definition" : "http://hl7.org/fhir/SearchParameter/Resource-source", + "type" : "token", + "documentation" : "How to sort the resources when returning" + }, + { + "name" : "_count", + "definition" : "http://hl7.org/fhir/SearchParameter/Resource-count", + "type" : "number", + "documentation" : "How many resources to return" + }, + { + "name" : "_include", + "definition" : "http://hl7.org/fhir/SearchParameter/Resource-include", + "type" : "token", + "documentation" : "Control over returning additional resources (see spec)" + }, + { + "name" : "_revinclude", + "definition" : "http://hl7.org/fhir/SearchParameter/Resource-revinclude", + "type" : "token", + "documentation" : "Control over returning additional resources (see spec)" + }, + { + "name" : "_summary", + "definition" : "http://hl7.org/fhir/SearchParameter/Resource-summary", + "type" : "token", + "documentation" : "What kind of information to return" + }, + { + "name" : "_elements", + "definition" : "http://hl7.org/fhir/SearchParameter/Resource-elements", + "type" : "string", + "documentation" : "What kind of information to return" + }, + { + "name" : "_contained", + "definition" : "http://hl7.org/fhir/SearchParameter/Resource-contained", + "type" : "token", + "documentation" : "Managing search into contained resources" + }, + { + "name" : "_containedType", + "definition" : "http://hl7.org/fhir/SearchParameter/Resource-containedType", + "type" : "token", + "documentation" : "Managing search into contained resources" + }, + { + "name" : "something", + "definition" : "http://hl7.org/fhir/SearchParameter/id", + "type" : "string", + "documentation" : "some doco" + }, + { + "name" : "_list", + "definition" : "http://hl7.org/fhir/SearchParameter/Resource-list", + "type" : "token", + "documentation" : "Retrieval of resources that are referenced by a List resource" + }, + { + "name" : "_has", + "definition" : "http://hl7.org/fhir/SearchParameter/Resource-has", + "type" : "composite", + "documentation" : "Provides support for reverse chaining" + }, + { + "name" : "_type", + "definition" : "http://hl7.org/fhir/SearchParameter/Resource-type", + "type" : "token", + "documentation" : "Type of resource (when doing cross-resource search" + }, + { + "name" : "_sort", + "definition" : "http://hl7.org/fhir/SearchParameter/Resource-source", + "type" : "token", + "documentation" : "How to sort the resources when returning" + }, + { + "name" : "_count", + "definition" : "http://hl7.org/fhir/SearchParameter/Resource-count", + "type" : "number", + "documentation" : "How many resources to return" + }, + { + "name" : "_include", + "definition" : "http://hl7.org/fhir/SearchParameter/Resource-include", + "type" : "token", + "documentation" : "Control over returning additional resources (see spec)" + }, + { + "name" : "_revinclude", + "definition" : "http://hl7.org/fhir/SearchParameter/Resource-revinclude", + "type" : "token", + "documentation" : "Control over returning additional resources (see spec)" + }, + { + "name" : "_summary", + "definition" : "http://hl7.org/fhir/SearchParameter/Resource-summary", + "type" : "token", + "documentation" : "What kind of information to return" + }, + { + "name" : "_elements", + "definition" : "http://hl7.org/fhir/SearchParameter/Resource-elements", + "type" : "string", + "documentation" : "What kind of information to return" + }, + { + "name" : "_contained", + "definition" : "http://hl7.org/fhir/SearchParameter/Resource-contained", + "type" : "token", + "documentation" : "Managing search into contained resources" + }, + { + "name" : "_containedType", + "definition" : "http://hl7.org/fhir/SearchParameter/Resource-containedType", + "type" : "token", + "documentation" : "Managing search into contained resources" + }, + { + "name" : "_query", + "definition" : "http://hl7.org/fhir/SearchParameter/Resource-query", + "type" : "token", + "documentation" : "A custom search profile that describes a specific defined query operation" + }, + { + "name" : "_profile", + "definition" : "http://hl7.org/fhir/SearchParameter/Resource-profile", + "type" : "reference", + "documentation" : "Profiles this resource claims to conform to" + }, + { + "name" : "_lastUpdated", + "definition" : "http://hl7.org/fhir/SearchParameter/Resource-lastUpdated", + "type" : "date", + "documentation" : "When the resource version last changed" + }, + { + "name" : "_tag", + "definition" : "http://hl7.org/fhir/SearchParameter/Resource-tag", + "type" : "token", + "documentation" : "Tags applied to this resource" + }, + { + "name" : "_security", + "definition" : "http://hl7.org/fhir/SearchParameter/Resource-security", + "type" : "token", + "documentation" : "Security Labels applied to this resource" + }, + { + "name" : "_source", + "definition" : "http://hl7.org/fhir/SearchParameter/Resource-source", + "type" : "uri", + "documentation" : "Identifies where the resource comes from" + }, + { + "name" : "_id", + "definition" : "http://hl7.org/fhir/SearchParameter/Resource-id", + "type" : "token", + "documentation" : "Logical id of this artifact" + }, + { + "name" : "_content", + "definition" : "http://hl7.org/fhir/SearchParameter/Resource-content", + "type" : "string", + "documentation" : "Search on the entire content of the resource" + }, + { + "name" : "something", + "definition" : "http://hl7.org/fhir/SearchParameter/id", + "type" : "string", + "documentation" : "some doco" + }, + { + "name" : "_list", + "definition" : "http://hl7.org/fhir/SearchParameter/Resource-list", + "type" : "token", + "documentation" : "Retrieval of resources that are referenced by a List resource" + }, + { + "name" : "_has", + "definition" : "http://hl7.org/fhir/SearchParameter/Resource-has", + "type" : "composite", + "documentation" : "Provides support for reverse chaining" + }, + { + "name" : "_type", + "definition" : "http://hl7.org/fhir/SearchParameter/Resource-type", + "type" : "token", + "documentation" : "Type of resource (when doing cross-resource search" + }, + { + "name" : "_sort", + "definition" : "http://hl7.org/fhir/SearchParameter/Resource-source", + "type" : "token", + "documentation" : "How to sort the resources when returning" + }, + { + "name" : "_count", + "definition" : "http://hl7.org/fhir/SearchParameter/Resource-count", + "type" : "number", + "documentation" : "How many resources to return" + }, + { + "name" : "_include", + "definition" : "http://hl7.org/fhir/SearchParameter/Resource-include", + "type" : "token", + "documentation" : "Control over returning additional resources (see spec)" + }, + { + "name" : "_revinclude", + "definition" : "http://hl7.org/fhir/SearchParameter/Resource-revinclude", + "type" : "token", + "documentation" : "Control over returning additional resources (see spec)" + }, + { + "name" : "_summary", + "definition" : "http://hl7.org/fhir/SearchParameter/Resource-summary", + "type" : "token", + "documentation" : "What kind of information to return" + }, + { + "name" : "_elements", + "definition" : "http://hl7.org/fhir/SearchParameter/Resource-elements", + "type" : "string", + "documentation" : "What kind of information to return" + }, + { + "name" : "_contained", + "definition" : "http://hl7.org/fhir/SearchParameter/Resource-contained", + "type" : "token", + "documentation" : "Managing search into contained resources" + }, + { + "name" : "_containedType", + "definition" : "http://hl7.org/fhir/SearchParameter/Resource-containedType", + "type" : "token", + "documentation" : "Managing search into contained resources" + }], + "operation" : [{ + "name" : "validate", + "definition" : "http://hl7.org/fhir/OperationDefinition/resource-validate" + }, + { + "name" : "meta", + "definition" : "http://hl7.org/fhir/OperationDefinition/resource-meta" + }, + { + "name" : "meta-add", + "definition" : "http://hl7.org/fhir/OperationDefinition/resource-meta-add" + }, + { + "name" : "meta-delete", + "definition" : "http://hl7.org/fhir/OperationDefinition/resource-meta-delete" + }, + { + "name" : "convert", + "definition" : "http://hl7.org/fhir/OperationDefinition/resource-convert" + }, + { + "name" : "graphql", + "definition" : "http://hl7.org/fhir/OperationDefinition/resource-graphql" + }, + { + "name" : "graph", + "definition" : "http://hl7.org/fhir/OperationDefinition/resource-graph" + }, + { + "name" : "apply", + "definition" : "http://hl7.org/fhir/OperationDefinition/activitydefinition-apply" + }, + { + "name" : "data-requirements", + "definition" : "http://hl7.org/fhir/OperationDefinition/activitydefinition-data-requirements" + }, + { + "name" : "subset", + "definition" : "http://hl7.org/fhir/OperationDefinition/capabilitystatement-subset" + }, + { + "name" : "implements", + "definition" : "http://hl7.org/fhir/OperationDefinition/capabilitystatement-implements" + }, + { + "name" : "conforms", + "definition" : "http://hl7.org/fhir/OperationDefinition/capabilitystatement-conforms" + }, + { + "name" : "versions", + "definition" : "http://hl7.org/fhir/OperationDefinition/capabilitystatement-versions" + }, + { + "name" : "subset", + "definition" : "http://hl7.org/fhir/OperationDefinition/capabilitystatement2-subset" + }, + { + "name" : "implements", + "definition" : "http://hl7.org/fhir/OperationDefinition/capabilitystatement2-implements" + }, + { + "name" : "conforms", + "definition" : "http://hl7.org/fhir/OperationDefinition/capabilitystatement2-conforms" + }, + { + "name" : "versions", + "definition" : "http://hl7.org/fhir/OperationDefinition/capabilitystatement2-versions" + }, + { + "name" : "apply", + "definition" : "http://hl7.org/fhir/OperationDefinition/chargeitemdefinition-apply" + }, + { + "name" : "submit", + "definition" : "http://hl7.org/fhir/OperationDefinition/claim-submit" + }, + { + "name" : "lookup", + "definition" : "http://hl7.org/fhir/OperationDefinition/codesystem-lookup" + }, + { + "name" : "validate-code", + "definition" : "http://hl7.org/fhir/OperationDefinition/codesystem-validate-code" + }, + { + "name" : "subsumes", + "definition" : "http://hl7.org/fhir/OperationDefinition/codesystem-subsumes" + }, + { + "name" : "find-matches", + "definition" : "http://hl7.org/fhir/OperationDefinition/codesystem-find-matches" + }, + { + "name" : "document", + "definition" : "http://hl7.org/fhir/OperationDefinition/composition-document" + }, + { + "name" : "translate", + "definition" : "http://hl7.org/fhir/OperationDefinition/conceptmap-translate" + }, + { + "name" : "closure", + "definition" : "http://hl7.org/fhir/OperationDefinition/conceptmap-closure" + }, + { + "name" : "submit", + "definition" : "http://hl7.org/fhir/OperationDefinition/coverageeligibilityrequest-submit" + }, + { + "name" : "everything", + "definition" : "http://hl7.org/fhir/OperationDefinition/encounter-everything" + }, + { + "name" : "everything", + "definition" : "http://hl7.org/fhir/OperationDefinition/group-everything" + }, + { + "name" : "data-requirements", + "definition" : "http://hl7.org/fhir/OperationDefinition/library-data-requirements" + }, + { + "name" : "find", + "definition" : "http://hl7.org/fhir/OperationDefinition/list-find" + }, + { + "name" : "evaluate-measure", + "definition" : "http://hl7.org/fhir/OperationDefinition/measure-evaluate-measure" + }, + { + "name" : "data-requirements", + "definition" : "http://hl7.org/fhir/OperationDefinition/measure-data-requirements" + }, + { + "name" : "submit-data", + "definition" : "http://hl7.org/fhir/OperationDefinition/measure-submit-data" + }, + { + "name" : "collect-data", + "definition" : "http://hl7.org/fhir/OperationDefinition/measure-collect-data" + }, + { + "name" : "care-gaps", + "definition" : "http://hl7.org/fhir/OperationDefinition/measure-care-gaps" + }, + { + "name" : "process-message", + "definition" : "http://hl7.org/fhir/OperationDefinition/messageheader-process-message" + }, + { + "name" : "preferred-id", + "definition" : "http://hl7.org/fhir/OperationDefinition/namingsystem-preferred-id" + }, + { + "name" : "stats", + "definition" : "http://hl7.org/fhir/OperationDefinition/observation-stats" + }, + { + "name" : "lastn", + "definition" : "http://hl7.org/fhir/OperationDefinition/observation-lastn" + }, + { + "name" : "match", + "definition" : "http://hl7.org/fhir/OperationDefinition/patient-match" + }, + { + "name" : "everything", + "definition" : "http://hl7.org/fhir/OperationDefinition/patient-everything" + }, + { + "name" : "apply", + "definition" : "http://hl7.org/fhir/OperationDefinition/plandefinition-apply" + }, + { + "name" : "data-requirements", + "definition" : "http://hl7.org/fhir/OperationDefinition/plandefinition-data-requirements" + }, + { + "name" : "everything", + "definition" : "http://hl7.org/fhir/OperationDefinition/regulatedmedicinalproduct-everything" + }, + { + "name" : "questionnaire", + "definition" : "http://hl7.org/fhir/OperationDefinition/structuredefinition-questionnaire" + }, + { + "name" : "snapshot", + "definition" : "http://hl7.org/fhir/OperationDefinition/structuredefinition-snapshot" + }, + { + "name" : "transform", + "definition" : "http://hl7.org/fhir/OperationDefinition/structuremap-transform" + }, + { + "name" : "expand", + "definition" : "http://hl7.org/fhir/OperationDefinition/valueset-expand" + }, + { + "name" : "validate-code", + "definition" : "http://hl7.org/fhir/OperationDefinition/valueset-validate-code" + }] + }] +} \ No newline at end of file diff --git a/org.hl7.fhir.r5/src/main/resources/openapi/cs-base2.json b/org.hl7.fhir.r5/src/main/resources/openapi/cs-base2.json new file mode 100644 index 000000000..c35346182 --- /dev/null +++ b/org.hl7.fhir.r5/src/main/resources/openapi/cs-base2.json @@ -0,0 +1,45 @@ +{ + "resourceType" : "CapabilityStatement", + "id" : "base2", + "text" : { + "status" : "generated", + "div" : "

Base FHIR Capability Statement (Empty)

This is the base Capability Statement for FHIR. It represents a server that provides the none of the functionality defined by FHIR. It is provided to use as a template for system designers to build their own Capability Statements from. A capability statement has to contain something, so this contains a read of a Capability Statement

\n
ModeSERVER
DescriptionAn empty Capability Statement
Transaction
System History
System Search
Resource TypeProfileReadSearchUpdateCreate
CapabilityStatementy
" + }, + "url" : "http://hl7.org/fhir/CapabilityStatement/base2", + "version" : "4.1.0", + "name" : "Base FHIR Capability Statement (Empty)", + "status" : "draft", + "experimental" : true, + "date" : "2019-06-01T11:22:02+10:00", + "publisher" : "FHIR Project Team", + "contact" : [{ + "telecom" : [{ + "system" : "url", + "value" : "http://hl7.org/fhir" + }] + }], + "description" : "This is the base Capability Statement for FHIR. It represents a server that provides the none of the functionality defined by FHIR. It is provided to use as a template for system designers to build their own Capability Statements from. A capability statement has to contain something, so this contains a read of a Capability Statement", + "kind" : "capability", + "software" : { + "name" : "Insert your software name here..." + }, + "fhirVersion" : "4.1.0", + "format" : ["xml", + "json"], + "rest" : [{ + "mode" : "server", + "documentation" : "An empty Capability Statement", + "security" : { + "cors" : true, + "service" : [{ + "coding" : [{ + "system" : "http://terminology.hl7.org/CodeSystem/restful-security-service", + "code" : "SMART-on-FHIR", + "display" : "SMART-on-FHIR" + }], + "text" : "See http://docs.smarthealthit.org/" + }], + "description" : "This is the Capability Statement to declare that the server supports SMART-on-FHIR. See the SMART-on-FHIR docs for the extension that would go with such a server" + } + }] +} \ No newline at end of file diff --git a/org.hl7.fhir.r5/src/main/resources/openapi/swagger-base.json b/org.hl7.fhir.r5/src/main/resources/openapi/swagger-base.json new file mode 100644 index 000000000..1d1c72f92 --- /dev/null +++ b/org.hl7.fhir.r5/src/main/resources/openapi/swagger-base.json @@ -0,0 +1,1269 @@ +{ + "openapi": "3.0.2", + "info": { + "description": "This is the base Capability Statement for FHIR. It represents a server that provides the full set of functionality defined by FHIR. It is provided to use as a template for system designers to build their own Capability Statements from", + "license": { + "name": "test-lic", + "url": "http://spdx.org/licenses/test-lic.html" + }, + "version": "4.1.0", + "contact": { + "name": "FHIR Project Team" + } + }, + "externalDocs": { + "url": "http://hl7.org/fhir/CapabilityStatement/base", + "description": "FHIR CapabilityStatement" + }, + "paths": { + "/metadata": { + "summary": "Access to the Server\u0027s Capability Statement", + "description": "All FHIR Servers return a CapabilityStatement that describes what services they perform", + "get": { + "summary": "Return the server\u0027s capability statement", + "operationId": "metadata", + "responses": { + "default": { + "description": "Error, with details", + "content": { + "application/fhir+json": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/OperationOutcome" + } + }, + "application/fhir+xml": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/OperationOutcome.xsd" + } + } + } + }, + "200": { + "description": "the capbility statement", + "content": { + "application/fhir+json": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/CapabilityStatement" + } + }, + "application/fhir+xml": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/CapabilityStatement.xsd" + } + } + } + } + }, + "parameters": [ + { + "$ref": "#/Components/parameters/format" + }, + { + "$ref": "#/Components/parameters/pretty" + }, + { + "$ref": "#/Components/parameters/summary" + }, + { + "$ref": "#/Components/parameters/elements" + } + ] + } + }, + "/Account": { + "summary": "Manager for resources of type Account", + "description": "The Manager for resources of type Account: provides services to manage the collection of all the Account instances", + "get": { + "summary": "Search all resources of type Account based on a set of criteria", + "operationId": "searchAccount", + "responses": { + "default": { + "description": "Error, with details", + "content": { + "application/fhir+json": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/OperationOutcome" + } + }, + "application/fhir+xml": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/OperationOutcome.xsd" + } + } + } + }, + "200": { + "description": "the resource being returned", + "content": { + "application/fhir+json": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/Bundle" + } + }, + "application/fhir+xml": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/Bundle.xsd" + } + } + } + } + }, + "parameters": [ + { + "$ref": "#/Components/parameters/format" + }, + { + "$ref": "#/Components/parameters/pretty" + }, + { + "$ref": "#/Components/parameters/summary" + }, + { + "$ref": "#/Components/parameters/elements" + }, + { + "name": "owner", + "in": "query", + "description": "Entity managing the Account", + "schema": { + "type": "string" + } + }, + { + "name": "identifier", + "in": "query", + "description": "Account number", + "schema": { + "type": "string" + } + }, + { + "name": "period", + "in": "query", + "description": "Transaction window", + "schema": { + "type": "dateTime" + } + }, + { + "name": "subject", + "in": "query", + "description": "The entity that caused the expenses", + "schema": { + "type": "string" + } + }, + { + "name": "patient", + "in": "query", + "description": "The entity that caused the expenses", + "schema": { + "type": "string" + } + }, + { + "name": "name", + "in": "query", + "description": "Human-readable label", + "schema": { + "type": "string" + } + }, + { + "name": "type", + "in": "query", + "description": "E.g. patient, expense, depreciation", + "schema": { + "type": "string" + } + }, + { + "name": "status", + "in": "query", + "description": "active | inactive | entered-in-error | on-hold | unknown", + "schema": { + "type": "string" + } + } + ] + }, + "put": { + "summary": "Create a new resource", + "operationId": "createAccount", + "requestBody": { + "description": "The new state of the resource", + "required": true, + "content": { + "application/fhir+json": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/Account" + } + }, + "application/fhir+xml": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/Account.xsd" + } + } + } + }, + "responses": { + "default": { + "description": "Error, with details", + "content": { + "application/fhir+json": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/OperationOutcome" + } + }, + "application/fhir+xml": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/OperationOutcome.xsd" + } + } + } + }, + "200": { + "description": "the resource being returned after being updated", + "headers": { + "ETag": { + "description": "Version from Resource.meta.version as a weak ETag" + } + }, + "content": { + "application/fhir+json": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/Account" + } + }, + "application/fhir+xml": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/Account.xsd" + } + } + } + } + }, + "parameters": [ + { + "$ref": "#/Components/parameters/summary" + }, + { + "$ref": "#/Components/parameters/format" + }, + { + "$ref": "#/Components/parameters/pretty" + }, + { + "$ref": "#/Components/parameters/elements" + } + ] + } + }, + "/Account/{rid}": { + "summary": "Read/Write/etc resource instance of type Account", + "description": "Access to services to manage the state of a single resource of type Account", + "get": { + "summary": "Read the current state of the resource", + "operationId": "readAccount", + "responses": { + "default": { + "description": "Error, with details", + "content": { + "application/fhir+json": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/OperationOutcome" + } + }, + "application/fhir+xml": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/OperationOutcome.xsd" + } + } + } + }, + "200": { + "description": "the resource being returned", + "headers": { + "ETag": { + "description": "Version from Resource.meta.version as a weak ETag" + } + }, + "content": { + "application/fhir+json": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/Account" + } + }, + "application/fhir+xml": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/Account.xsd" + } + } + } + } + }, + "parameters": [ + { + "$ref": "#/Components/parameters/summary" + }, + { + "$ref": "#/Components/parameters/format" + }, + { + "$ref": "#/Components/parameters/pretty" + }, + { + "$ref": "#/Components/parameters/elements" + } + ] + }, + "put": { + "summary": "Update the current state of the resource", + "operationId": "updateAccount", + "requestBody": { + "description": "The new state of the resource", + "required": true, + "content": { + "application/fhir+json": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/Account" + } + }, + "application/fhir+xml": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/Account.xsd" + } + } + } + }, + "responses": { + "default": { + "description": "Error, with details", + "content": { + "application/fhir+json": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/OperationOutcome" + } + }, + "application/fhir+xml": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/OperationOutcome.xsd" + } + } + } + }, + "200": { + "description": "the resource being returned after being updated", + "headers": { + "ETag": { + "description": "Version from Resource.meta.version as a weak ETag" + } + }, + "content": { + "application/fhir+json": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/Account" + } + }, + "application/fhir+xml": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/Account.xsd" + } + } + } + } + }, + "parameters": [ + { + "$ref": "#/Components/parameters/summary" + }, + { + "$ref": "#/Components/parameters/format" + }, + { + "$ref": "#/Components/parameters/pretty" + }, + { + "$ref": "#/Components/parameters/elements" + } + ] + }, + "delete": { + "summary": "Delete the resource so that it no exists (no read, search etc)", + "operationId": "deleteAccount", + "responses": { + "default": { + "description": "Error, with details", + "content": { + "application/fhir+json": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/OperationOutcome" + } + }, + "application/fhir+xml": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/OperationOutcome.xsd" + } + } + } + }, + "204": { + "description": "If the resource is deleted - no content is returned", + "headers": { + "ETag": { + "description": "Version from Resource.meta.version as a weak ETag" + } + } + } + } + } + }, + "/Account/{rid}/_history": { + "summary": "Read past versions of resource instance of type Account", + "description": "Access to previous versions of a single resource of type Account", + "get": { + "summary": "Read the past states of the resource", + "operationId": "histinstAccount", + "responses": { + "default": { + "description": "Error, with details", + "content": { + "application/fhir+json": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/OperationOutcome" + } + }, + "application/fhir+xml": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/OperationOutcome.xsd" + } + } + } + }, + "200": { + "description": "the resources being returned", + "content": { + "application/fhir+json": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/Bundle" + } + }, + "application/fhir+xml": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/Bundle.xsd" + } + } + } + } + }, + "parameters": [ + { + "$ref": "#/Components/parameters/summary" + }, + { + "$ref": "#/Components/parameters/format" + }, + { + "$ref": "#/Components/parameters/pretty" + }, + { + "$ref": "#/Components/parameters/elements" + }, + { + "name": "_count", + "in": "query", + "description": "The maximum number of search results on a page. The server is not bound to return the number requested, but cannot return more", + "schema": { + "type": "number" + } + }, + { + "name": "_since", + "in": "query", + "description": "Only include resource versions that were created at or after the given instant in time", + "schema": { + "type": "dateTime" + } + }, + { + "name": "_at", + "in": "query", + "description": "Only include resource versions that were current at some point during the time period specified in the date time value (see Search notes on date searching)", + "schema": { + "type": "dateTime" + } + }, + { + "name": "_list", + "in": "query", + "description": "Only include resource versions that are referenced in the specified list (current list references are allowed)", + "schema": { + "type": "string" + } + } + ] + } + }, + "/Account/{rid}/_history/{hid}": { + "summary": "Read a past version of resource instance of type Account", + "description": "Access a to specified previous version of a single resource of type Account", + "get": { + "summary": "Read a past state of the resource", + "operationId": "vreadAccount", + "responses": { + "default": { + "description": "Error, with details", + "content": { + "application/fhir+json": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/OperationOutcome" + } + }, + "application/fhir+xml": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/OperationOutcome.xsd" + } + } + } + }, + "200": { + "description": "the resource being returned", + "headers": { + "ETag": { + "description": "Version from Resource.meta.version as a weak ETag for that version" + } + }, + "content": { + "application/fhir+json": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/Account" + } + }, + "application/fhir+xml": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/Account.xsd" + } + } + } + } + }, + "parameters": [ + { + "$ref": "#/Components/parameters/summary" + }, + { + "$ref": "#/Components/parameters/format" + }, + { + "$ref": "#/Components/parameters/pretty" + }, + { + "$ref": "#/Components/parameters/elements" + } + ] + } + }, + "/Account/_history": { + "summary": "Read past versions of resources of type Account", + "description": "Access to previous versions of resourcez of type Account", + "get": { + "summary": "Read the past states of the resource", + "operationId": "histinstAccount", + "responses": { + "default": { + "description": "Error, with details", + "content": { + "application/fhir+json": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/OperationOutcome" + } + }, + "application/fhir+xml": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/OperationOutcome.xsd" + } + } + } + }, + "200": { + "description": "the resources being returned", + "content": { + "application/fhir+json": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/Bundle" + } + }, + "application/fhir+xml": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/Bundle.xsd" + } + } + } + } + }, + "parameters": [ + { + "$ref": "#/Components/parameters/summary" + }, + { + "$ref": "#/Components/parameters/format" + }, + { + "$ref": "#/Components/parameters/pretty" + }, + { + "$ref": "#/Components/parameters/elements" + }, + { + "name": "_count", + "in": "query", + "description": "The maximum number of search results on a page. The server is not bound to return the number requested, but cannot return more", + "schema": { + "type": "number" + } + }, + { + "name": "_since", + "in": "query", + "description": "Only include resource versions that were created at or after the given instant in time", + "schema": { + "type": "dateTime" + } + }, + { + "name": "_at", + "in": "query", + "description": "Only include resource versions that were current at some point during the time period specified in the date time value (see Search notes on date searching)", + "schema": { + "type": "dateTime" + } + }, + { + "name": "_list", + "in": "query", + "description": "Only include resource versions that are referenced in the specified list (current list references are allowed)", + "schema": { + "type": "string" + } + } + ] + } + }, + "/_history": { + "summary": "Read a past version of resource instance of all types", + "description": "Access a previous versions of all types", + "get": { + "summary": "Read the past states of all resources", + "operationId": "histinstAll", + "responses": { + "default": { + "description": "Error, with details", + "content": { + "application/fhir+json": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/OperationOutcome" + } + }, + "application/fhir+xml": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/OperationOutcome.xsd" + } + } + } + }, + "200": { + "description": "the resources being returned", + "content": { + "application/fhir+json": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/Bundle" + } + }, + "application/fhir+xml": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/Bundle.xsd" + } + } + } + } + }, + "parameters": [ + { + "$ref": "#/Components/parameters/summary" + }, + { + "$ref": "#/Components/parameters/format" + }, + { + "$ref": "#/Components/parameters/pretty" + }, + { + "$ref": "#/Components/parameters/elements" + }, + { + "name": "_count", + "in": "query", + "description": "The maximum number of search results on a page. The server is not bound to return the number requested, but cannot return more", + "schema": { + "type": "number" + } + }, + { + "name": "_since", + "in": "query", + "description": "Only include resource versions that were created at or after the given instant in time", + "schema": { + "type": "dateTime" + } + }, + { + "name": "_at", + "in": "query", + "description": "Only include resource versions that were current at some point during the time period specified in the date time value (see Search notes on date searching)", + "schema": { + "type": "dateTime" + } + }, + { + "name": "_list", + "in": "query", + "description": "Only include resource versions that are referenced in the specified list (current list references are allowed)", + "schema": { + "type": "string" + } + } + ] + } + }, + "/": { + "summary": "System level operations", + "description": "System level operations", + "get": { + "summary": "Search all resources of all types based on a set of criteria", + "operationId": "searchAll", + "responses": { + "default": { + "description": "Error, with details", + "content": { + "application/fhir+json": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/OperationOutcome" + } + }, + "application/fhir+xml": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/OperationOutcome.xsd" + } + } + } + }, + "200": { + "description": "the resource being returned", + "content": { + "application/fhir+json": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/Bundle" + } + }, + "application/fhir+xml": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/Bundle.xsd" + } + } + } + } + }, + "parameters": [ + { + "$ref": "#/Components/parameters/format" + }, + { + "$ref": "#/Components/parameters/pretty" + }, + { + "$ref": "#/Components/parameters/summary" + }, + { + "$ref": "#/Components/parameters/elements" + }, + { + "name": "_text", + "in": "query", + "description": "Search on the narrative of the resource", + "schema": { + "type": "string" + } + }, + { + "name": "something", + "in": "query", + "description": "some doco", + "schema": { + "type": "string" + } + }, + { + "name": "_list", + "in": "query", + "description": "Retrieval of resources that are referenced by a List resource", + "schema": { + "type": "string" + } + }, + { + "name": "_has", + "in": "query", + "description": "Provides support for reverse chaining", + "schema": {} + }, + { + "name": "_type", + "in": "query", + "description": "Type of resource (when doing cross-resource search", + "schema": { + "type": "string" + } + }, + { + "name": "_sort", + "in": "query", + "description": "Identifies where the resource comes from", + "schema": { + "type": "string" + } + }, + { + "name": "_count", + "in": "query", + "description": "How many resources to return", + "schema": { + "type": "number" + } + }, + { + "name": "_include", + "in": "query", + "description": "Control over returning additional resources (see spec)", + "schema": { + "type": "string" + } + }, + { + "name": "_revinclude", + "in": "query", + "description": "Control over returning additional resources (see spec)", + "schema": { + "type": "string" + } + }, + { + "name": "_summary", + "in": "query", + "description": "What kind of information to return", + "schema": { + "type": "string" + } + }, + { + "name": "_elements", + "in": "query", + "description": "What kind of information to return", + "schema": { + "type": "string" + } + }, + { + "name": "_contained", + "in": "query", + "description": "Managing search into contained resources", + "schema": { + "type": "string" + } + }, + { + "name": "_containedType", + "in": "query", + "description": "Managing search into contained resources", + "schema": { + "type": "string" + } + }, + { + "name": "something", + "in": "query", + "description": "some doco", + "schema": { + "type": "string" + } + }, + { + "name": "_list", + "in": "query", + "description": "Retrieval of resources that are referenced by a List resource", + "schema": { + "type": "string" + } + }, + { + "name": "_has", + "in": "query", + "description": "Provides support for reverse chaining", + "schema": {} + }, + { + "name": "_type", + "in": "query", + "description": "Type of resource (when doing cross-resource search", + "schema": { + "type": "string" + } + }, + { + "name": "_sort", + "in": "query", + "description": "Identifies where the resource comes from", + "schema": { + "type": "string" + } + }, + { + "name": "_count", + "in": "query", + "description": "How many resources to return", + "schema": { + "type": "number" + } + }, + { + "name": "_include", + "in": "query", + "description": "Control over returning additional resources (see spec)", + "schema": { + "type": "string" + } + }, + { + "name": "_revinclude", + "in": "query", + "description": "Control over returning additional resources (see spec)", + "schema": { + "type": "string" + } + }, + { + "name": "_summary", + "in": "query", + "description": "What kind of information to return", + "schema": { + "type": "string" + } + }, + { + "name": "_elements", + "in": "query", + "description": "What kind of information to return", + "schema": { + "type": "string" + } + }, + { + "name": "_contained", + "in": "query", + "description": "Managing search into contained resources", + "schema": { + "type": "string" + } + }, + { + "name": "_containedType", + "in": "query", + "description": "Managing search into contained resources", + "schema": { + "type": "string" + } + }, + { + "name": "_query", + "in": "query", + "description": "A custom search profile that describes a specific defined query operation", + "schema": { + "type": "string" + } + }, + { + "name": "_profile", + "in": "query", + "description": "Profiles this resource claims to conform to", + "schema": { + "type": "string" + } + }, + { + "name": "_lastUpdated", + "in": "query", + "description": "When the resource version last changed", + "schema": { + "type": "dateTime" + } + }, + { + "name": "_tag", + "in": "query", + "description": "Tags applied to this resource", + "schema": { + "type": "string" + } + }, + { + "name": "_security", + "in": "query", + "description": "Security Labels applied to this resource", + "schema": { + "type": "string" + } + }, + { + "name": "_source", + "in": "query", + "description": "Identifies where the resource comes from", + "schema": { + "type": "string" + } + }, + { + "name": "_id", + "in": "query", + "description": "Logical id of this artifact", + "schema": { + "type": "string" + } + }, + { + "name": "_content", + "in": "query", + "description": "Search on the entire content of the resource", + "schema": { + "type": "string" + } + }, + { + "name": "something", + "in": "query", + "description": "some doco", + "schema": { + "type": "string" + } + }, + { + "name": "_list", + "in": "query", + "description": "Retrieval of resources that are referenced by a List resource", + "schema": { + "type": "string" + } + }, + { + "name": "_has", + "in": "query", + "description": "Provides support for reverse chaining", + "schema": {} + }, + { + "name": "_type", + "in": "query", + "description": "Type of resource (when doing cross-resource search", + "schema": { + "type": "string" + } + }, + { + "name": "_sort", + "in": "query", + "description": "Identifies where the resource comes from", + "schema": { + "type": "string" + } + }, + { + "name": "_count", + "in": "query", + "description": "How many resources to return", + "schema": { + "type": "number" + } + }, + { + "name": "_include", + "in": "query", + "description": "Control over returning additional resources (see spec)", + "schema": { + "type": "string" + } + }, + { + "name": "_revinclude", + "in": "query", + "description": "Control over returning additional resources (see spec)", + "schema": { + "type": "string" + } + }, + { + "name": "_summary", + "in": "query", + "description": "What kind of information to return", + "schema": { + "type": "string" + } + }, + { + "name": "_elements", + "in": "query", + "description": "What kind of information to return", + "schema": { + "type": "string" + } + }, + { + "name": "_contained", + "in": "query", + "description": "Managing search into contained resources", + "schema": { + "type": "string" + } + }, + { + "name": "_containedType", + "in": "query", + "description": "Managing search into contained resources", + "schema": { + "type": "string" + } + } + ] + }, + "post": { + "summary": "Batch or Transaction", + "operationId": "transaction", + "requestBody": { + "description": "The batch or transaction", + "required": true, + "content": { + "application/fhir+json": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/Bundle" + } + }, + "application/fhir+xml": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/Bundle.xsd" + } + } + } + }, + "responses": { + "default": { + "description": "Error, with details", + "content": { + "application/fhir+json": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/OperationOutcome" + } + }, + "application/fhir+xml": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/OperationOutcome.xsd" + } + } + } + }, + "200": { + "description": "Batch or Transaction response", + "content": { + "application/fhir+json": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/Bundle" + } + }, + "application/fhir+xml": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/Bundle.xsd" + } + } + } + } + }, + "parameters": [ + { + "$ref": "#/Components/parameters/format" + }, + { + "$ref": "#/Components/parameters/pretty" + } + ] + } + } + }, + "components": { + "parameters": { + "summary": { + "summary": { + "name": "_summary", + "in": "query", + "description": "Requests the server to return a designated subset of the resource", + "allowEmptyValue": true, + "style": "matrix", + "schema": { + "type": "string", + "enum": [ + "true", + "text", + "data", + "count", + "false" + ] + } + } + }, + "format": { + "format": { + "name": "_format", + "in": "query", + "description": "Specify alternative response formats by their MIME-types (when a client is unable acccess accept: header)", + "allowEmptyValue": true, + "style": "matrix", + "schema": { + "type": "string", + "format": "mime-type" + } + } + }, + "pretty": { + "pretty": { + "name": "_pretty", + "in": "query", + "description": "Ask for a pretty printed response for human convenience", + "allowEmptyValue": true, + "style": "matrix", + "schema": { + "type": "boolean" + } + } + }, + "elements": { + "elements": { + "name": "_elements", + "in": "query", + "description": "Requests the server to return a collection of elements from the resource", + "allowEmptyValue": true, + "style": "matrix", + "explode": false, + "schema": { + "type": "array", + "format": "string" + } + } + } + } + } +} \ No newline at end of file diff --git a/org.hl7.fhir.r5/src/main/resources/openapi/swagger-base2.json b/org.hl7.fhir.r5/src/main/resources/openapi/swagger-base2.json new file mode 100644 index 000000000..c6567a4c8 --- /dev/null +++ b/org.hl7.fhir.r5/src/main/resources/openapi/swagger-base2.json @@ -0,0 +1,136 @@ +{ + "openapi": "3.0.2", + "info": { + "description": "This is the base Capability Statement for FHIR. It represents a server that provides the none of the functionality defined by FHIR. It is provided to use as a template for system designers to build their own Capability Statements from. A capability statement has to contain something, so this contains a read of a Capability Statement", + "license": { + "name": "test-lic", + "url": "http://spdx.org/licenses/test-lic.html" + }, + "version": "4.1.0", + "contact": { + "name": "FHIR Project Team" + } + }, + "externalDocs": { + "url": "http://hl7.org/fhir/CapabilityStatement/base2", + "description": "FHIR CapabilityStatement" + }, + "paths": { + "/metadata": { + "summary": "Access to the Server\u0027s Capability Statement", + "description": "All FHIR Servers return a CapabilityStatement that describes what services they perform", + "get": { + "summary": "Return the server\u0027s capability statement", + "operationId": "metadata", + "responses": { + "default": { + "description": "Error, with details", + "content": { + "application/fhir+json": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/OperationOutcome" + } + }, + "application/fhir+xml": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/OperationOutcome.xsd" + } + } + } + }, + "200": { + "description": "the capbility statement", + "content": { + "application/fhir+json": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/CapabilityStatement" + } + }, + "application/fhir+xml": { + "schema": { + "$ref": "http://hl7.org/fhir/STU3/CapabilityStatement.xsd" + } + } + } + } + }, + "parameters": [ + { + "$ref": "#/Components/parameters/format" + }, + { + "$ref": "#/Components/parameters/pretty" + }, + { + "$ref": "#/Components/parameters/summary" + }, + { + "$ref": "#/Components/parameters/elements" + } + ] + } + } + }, + "components": { + "parameters": { + "summary": { + "summary": { + "name": "_summary", + "in": "query", + "description": "Requests the server to return a designated subset of the resource", + "allowEmptyValue": true, + "style": "matrix", + "schema": { + "type": "string", + "enum": [ + "true", + "text", + "data", + "count", + "false" + ] + } + } + }, + "format": { + "format": { + "name": "_format", + "in": "query", + "description": "Specify alternative response formats by their MIME-types (when a client is unable acccess accept: header)", + "allowEmptyValue": true, + "style": "matrix", + "schema": { + "type": "string", + "format": "mime-type" + } + } + }, + "pretty": { + "pretty": { + "name": "_pretty", + "in": "query", + "description": "Ask for a pretty printed response for human convenience", + "allowEmptyValue": true, + "style": "matrix", + "schema": { + "type": "boolean" + } + } + }, + "elements": { + "elements": { + "name": "_elements", + "in": "query", + "description": "Requests the server to return a collection of elements from the resource", + "allowEmptyValue": true, + "style": "matrix", + "explode": false, + "schema": { + "type": "array", + "format": "string" + } + } + } + } + } +} \ No newline at end of file diff --git a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/AllR5Tests.java b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/AllR5Tests.java index 552a66157..e50d0029c 100644 --- a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/AllR5Tests.java +++ b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/AllR5Tests.java @@ -18,6 +18,7 @@ import org.junit.runners.Suite.SuiteClasses; NarrativeGeneratorTests.class, ShexGeneratorTests.class, BaseDateTimeTypeTest.class, + OpenApiGeneratorTest.class, SnapShotGenerationTests.class}) public class AllR5Tests { diff --git a/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/OpenApiGeneratorTest.java b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/OpenApiGeneratorTest.java new file mode 100644 index 000000000..e98236a44 --- /dev/null +++ b/org.hl7.fhir.r5/src/test/java/org/hl7/fhir/r5/test/OpenApiGeneratorTest.java @@ -0,0 +1,44 @@ +package org.hl7.fhir.r5.test; + +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; + +import org.hl7.fhir.exceptions.FHIRFormatError; +import org.hl7.fhir.r5.formats.JsonParser; +import org.hl7.fhir.r5.model.CapabilityStatement; +import org.hl7.fhir.r5.openapi.OpenApiGenerator; +import org.hl7.fhir.r5.openapi.Writer; +import org.hl7.fhir.r5.test.utils.TestingUtilities; +import org.hl7.fhir.utilities.xml.XMLUtil; +import org.junit.Test; +import org.w3c.dom.Document; + +public class OpenApiGeneratorTest { + + @Test + public void testBase1() throws IOException, FHIRFormatError { + String sfn = TestingUtilities.resourceNameToFile("openapi", "cs-base.json"); + String dfn = TestingUtilities.resourceNameToFile("openapi", "swagger-base.json"); + + run(sfn, dfn); + } + + @Test + public void testBase2() throws FHIRFormatError, FileNotFoundException, IOException { + String sfn = TestingUtilities.resourceNameToFile("openapi", "cs-base2.json"); + String dfn = TestingUtilities.resourceNameToFile("openapi", "swagger-base2.json"); + + run(sfn, dfn); + } + + public void run(String sfn, String dfn) throws IOException, FHIRFormatError, FileNotFoundException { + CapabilityStatement cs = (CapabilityStatement) new JsonParser().parse(new FileInputStream(sfn)); + Writer oa = new Writer(new FileOutputStream(dfn)); + OpenApiGenerator gen = new OpenApiGenerator(TestingUtilities.context(), cs, oa); + gen.generate("test-lic", "http://spdx.org/licenses/test-lic.html"); + oa.commit(); + } + +} diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/ValidationEngine.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/ValidationEngine.java index 912736ca5..0267d4c2f 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/ValidationEngine.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/ValidationEngine.java @@ -1069,5 +1069,26 @@ public class ValidationEngine { this.mapLog = new PrintWriter(mapLog); } + public void prepare() { + for (StructureDefinition sd : context.allStructures()) { + try { + makeSnapshot(sd); + } catch (Exception e) { + System.out.println("Process Note: Unable to generate snapshot for "+sd.present()); + } + } + } + + private void makeSnapshot(StructureDefinition sd) throws DefinitionException, FHIRException { + if (sd.hasSnapshot()) + return; + StructureDefinition sdb = context.fetchResource(StructureDefinition.class, sd.getBaseDefinition()); + if (sdb != null) { + makeSnapshot(sdb); + new ProfileUtilities(context, null, null).generateSnapshot(sdb, sd, sd.getUrl(), null, sd.getName()); + } + + } + } diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/Validator.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/Validator.java index c071a9558..3ea899d30 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/Validator.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/r5/validation/Validator.java @@ -432,6 +432,7 @@ public class Validator { System.out.println(" .. validate "+sources+" against "+profiles.toString()); else System.out.println(" .. validate "+sources); + validator.prepare(); // generate any missing snapshots Resource r = validator.validate(sources, profiles); if (output == null) { if (r instanceof Bundle)