From 706405e794a94a02da3f61ed86d78444089abf79 Mon Sep 17 00:00:00 2001 From: Grahame Grieve Date: Tue, 4 Jun 2019 14:03:32 +1000 Subject: [PATCH] open api work --- .../hl7/fhir/r5/openapi/ComponentsWriter.java | 2 +- .../hl7/fhir/r5/openapi/OpenApiGenerator.java | 224 ++++--- .../org/hl7/fhir/r5/openapi/SchemaWriter.java | 18 +- .../main/resources/openapi/swagger-base.json | 602 +++++++----------- .../main/resources/openapi/swagger-base2.json | 130 ++-- 5 files changed, 448 insertions(+), 528 deletions(-) diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/openapi/ComponentsWriter.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/openapi/ComponentsWriter.java index ff3687d83..a36af6d67 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/openapi/ComponentsWriter.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/openapi/ComponentsWriter.java @@ -20,7 +20,7 @@ public class ComponentsWriter extends BaseWriter { public ParameterWriter parameter(String name) { JsonObject po = new JsonObject(); - ensureMapObject("parameters", name).add(name, po); + ensureObject("parameters").add(name, po); return new ParameterWriter(po); } } 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 11aeffcdd..7f318e60a 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 @@ -1,6 +1,8 @@ package org.hl7.fhir.r5.openapi; +import java.util.HashSet; import java.util.List; +import java.util.Set; import org.hl7.fhir.r5.context.IWorkerContext; import org.hl7.fhir.r5.model.CapabilityStatement; @@ -37,7 +39,7 @@ public class OpenApiGenerator { } public void generate(String license, String url) { - dest.info().title(source.getTitle()).description(source.getDescription()).license(license, url).version(source.getVersion()); + dest.info().title(source.present()).description(source.getDescription()).license(license, url).version(source.getVersion()); for (ContactDetail cd : source.getContact()) { dest.info().contact(cd.getName(), email(cd.getTelecom()), url(cd.getTelecom())); } @@ -58,17 +60,28 @@ public class OpenApiGenerator { } 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) + components.parameter("rid").name("rid").in(ParameterLocation.path).description("id of the resource (=Resource.id)").required(true).allowEmptyValue(false).style(ParameterStyle.simple) + .schema().type(SchemaType.string); + + components.parameter("hid").name("hid").in(ParameterLocation.path).description("id of the history entry (=Resource.meta.versionId)").required(true).allowEmptyValue(false).style(ParameterStyle.simple) + .schema().type(SchemaType.string); + + components.parameter("summary").name("_summary").in(ParameterLocation.query).description("Requests the server to return a designated subset of the resource").allowEmptyValue().style(ParameterStyle.form) .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) + 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.form) .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) + components.parameter("pretty").name("_pretty").in(ParameterLocation.query).description("Ask for a pretty printed response for human convenience").allowEmptyValue().style(ParameterStyle.form) .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"); + SchemaWriter p = components.parameter("elements").name("_elements").in(ParameterLocation.query).description("Requests the server to return a collection of elements from the resource").allowEmptyValue().style(ParameterStyle.form).explode(false) + .schema(); + p.type(SchemaType.array).format("string"); + p.items().format("string"); + + components.parameter("count").name("_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); } private void generatePaths(CapabilityStatementRestComponent csr) { @@ -112,15 +125,15 @@ public class OpenApiGenerator { 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"); + resp.content("application/fhir+json").schemaRef(specRef()+"/fhir.schema.json#/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"); + 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) { @@ -131,17 +144,18 @@ public class OpenApiGenerator { 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"); + resp.header("ETag").description("Version from Resource.meta.version as a weak ETag").schema().type(SchemaType.string); if (isJson()) - resp.content("application/fhir+json").schemaRef(specRef()+"/fhir.json.schema#/definitions/"+r.getType()); + resp.content("application/fhir+json").schemaRef(specRef()+"/fhir.schema.json#/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"); - op.paramRef("#/Components/parameters/pretty"); - op.paramRef("#/Components/parameters/elements"); + op.paramRef("#/components/parameters/rid"); + op.paramRef("#/components/parameters/summary"); + op.paramRef("#/components/parameters/format"); + op.paramRef("#/components/parameters/pretty"); + op.paramRef("#/components/parameters/elements"); } private void generateSearch(CapabilityStatementRestResourceComponent r) { @@ -152,22 +166,26 @@ public class OpenApiGenerator { 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"); + resp.content("application/fhir+json").schemaRef(specRef()+"/fhir.schema.json#/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"); + op.paramRef("#/components/parameters/format"); + op.paramRef("#/components/parameters/pretty"); + op.paramRef("#/components/parameters/summary"); + op.paramRef("#/components/parameters/elements"); + Set set = new HashSet<>(); for (CapabilityStatementRestResourceSearchParamComponent spc : r.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()); + if (!set.contains(spc.getName())) { + set.add(spc.getName()); + 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()); + } } } } @@ -181,22 +199,30 @@ public class OpenApiGenerator { 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"); + resp.content("application/fhir+json").schemaRef(specRef()+"/fhir.schema.json#/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"); + op.paramRef("#/components/parameters/format"); + op.paramRef("#/components/parameters/pretty"); + op.paramRef("#/components/parameters/summary"); + op.paramRef("#/components/parameters/elements"); + Set set = new HashSet<>(); + set.add("_summary"); + set.add("_format"); + set.add("_pretty"); + set.add("_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()); + if (!set.contains(spc.getName())) { + set.add(spc.getName()); + 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()); + } } } } @@ -219,20 +245,20 @@ public class OpenApiGenerator { 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()); + op.operationId("histtype"+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"); + resp.content("application/fhir+json").schemaRef(specRef()+"/fhir.schema.json#/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.paramRef("#/components/parameters/summary"); + op.paramRef("#/components/parameters/format"); + op.paramRef("#/components/parameters/pretty"); + op.paramRef("#/components/parameters/elements"); + op.paramRef("#/components/parameters/count"); - 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); @@ -246,15 +272,16 @@ public class OpenApiGenerator { 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"); + resp.content("application/fhir+json").schemaRef(specRef()+"/fhir.schema.json#/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.paramRef("#/components/parameters/rid"); + op.paramRef("#/components/parameters/summary"); + op.paramRef("#/components/parameters/format"); + op.paramRef("#/components/parameters/pretty"); + op.paramRef("#/components/parameters/elements"); + op.paramRef("#/components/parameters/count"); - 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); @@ -263,20 +290,20 @@ public class OpenApiGenerator { private void generateHistorySystem(CapabilityStatementRestComponent csr) { OperationWriter op = makePathHistListSystem().operation("get"); op.summary("Read the past states of all resources"); - op.operationId("histinstAll"); + op.operationId("histAll"); 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"); + resp.content("application/fhir+json").schemaRef(specRef()+"/fhir.schema.json#/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.paramRef("#/components/parameters/summary"); + op.paramRef("#/components/parameters/format"); + op.paramRef("#/components/parameters/pretty"); + op.paramRef("#/components/parameters/elements"); + op.paramRef("#/components/parameters/count"); - 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); @@ -290,15 +317,17 @@ public class OpenApiGenerator { 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 for that version"); + resp.header("ETag").description("Version from Resource.meta.version as a weak ETag for that version").schema().type(SchemaType.string); if (isJson()) - resp.content("application/fhir+json").schemaRef(specRef()+"/fhir.json.schema#/definitions/"+r.getType()); + resp.content("application/fhir+json").schemaRef(specRef()+"/fhir.schema.json#/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"); + op.paramRef("#/components/parameters/rid"); + op.paramRef("#/components/parameters/hid"); + op.paramRef("#/components/parameters/summary"); + op.paramRef("#/components/parameters/format"); + op.paramRef("#/components/parameters/pretty"); + op.paramRef("#/components/parameters/elements"); } // todo: how does prefer header affect return type? @@ -312,7 +341,7 @@ public class OpenApiGenerator { RequestBodyWriter req = op.request(); req.description("The new state of the resource").required(true); if (isJson()) - req.content("application/fhir+json").schemaRef(specRef()+"/fhir.json.schema#/definitions/"+r.getType()); + req.content("application/fhir+json").schemaRef(specRef()+"/fhir.schema.json#/definitions/"+r.getType()); if (isXml()) req.content("application/fhir+xml").schemaRef(specRef()+"/"+r.getType()+".xsd"); @@ -320,15 +349,16 @@ public class OpenApiGenerator { ResponseObjectWriter resp = op.responses().httpResponse("200"); resp.description("the resource being returned after being updated"); if (r.getVersioning() != ResourceVersionPolicy.NOVERSION) - resp.header("ETag").description("Version from Resource.meta.version as a weak ETag"); + resp.header("ETag").description("Version from Resource.meta.version as a weak ETag").schema().type(SchemaType.string); if (isJson()) - resp.content("application/fhir+json").schemaRef(specRef()+"/fhir.json.schema#/definitions/"+r.getType()); + resp.content("application/fhir+json").schemaRef(specRef()+"/fhir.schema.json#/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"); + op.paramRef("#/components/parameters/rid"); + op.paramRef("#/components/parameters/summary"); + op.paramRef("#/components/parameters/format"); + op.paramRef("#/components/parameters/pretty"); + op.paramRef("#/components/parameters/elements"); } private void generatePatch(CapabilityStatementRestResourceComponent r) { @@ -338,8 +368,8 @@ public class OpenApiGenerator { 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"); + req.content("application/json-patch+json").schemaRef(specRef()+"/fhir.schema.json#/definitions/"+r.getType()); + req.content("application/fhir+json").schemaRef(specRef()+"/fhir.schema.json#/definitions/Parameters"); } if (isXml()) { req.content("application/xml-patch+xml").schemaRef(specRef()+"/"+r.getType()+".xsd"); @@ -350,15 +380,16 @@ public class OpenApiGenerator { 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"); + resp.header("ETag").description("Version from Resource.meta.version as a weak ETag").schema().type(SchemaType.string); if (isJson()) - resp.content("application/fhir+json").schemaRef(specRef()+"/fhir.json.schema#/definitions/"+r.getType()); + resp.content("application/fhir+json").schemaRef(specRef()+"/fhir.schema.json#/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"); + op.paramRef("#/components/parameters/rid"); + 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) { @@ -369,7 +400,8 @@ public class OpenApiGenerator { 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"); + resp.header("ETag").description("Version from Resource.meta.version as a weak ETag").schema().type(SchemaType.string); + op.paramRef("#/components/parameters/rid"); } private void generateCreate(CapabilityStatementRestResourceComponent r) { @@ -379,7 +411,7 @@ public class OpenApiGenerator { RequestBodyWriter req = op.request(); req.description("The new state of the resource").required(true); if (isJson()) - req.content("application/fhir+json").schemaRef(specRef()+"/fhir.json.schema#/definitions/"+r.getType()); + req.content("application/fhir+json").schemaRef(specRef()+"/fhir.schema.json#/definitions/"+r.getType()); if (isXml()) req.content("application/fhir+xml").schemaRef(specRef()+"/"+r.getType()+".xsd"); @@ -387,15 +419,15 @@ public class OpenApiGenerator { ResponseObjectWriter resp = op.responses().httpResponse("200"); resp.description("the resource being returned after being updated"); if (r.getVersioning() != ResourceVersionPolicy.NOVERSION) - resp.header("ETag").description("Version from Resource.meta.version as a weak ETag"); + resp.header("ETag").description("Version from Resource.meta.version as a weak ETag").schema().type(SchemaType.string); if (isJson()) - resp.content("application/fhir+json").schemaRef(specRef()+"/fhir.json.schema#/definitions/"+r.getType()); + resp.content("application/fhir+json").schemaRef(specRef()+"/fhir.schema.json#/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"); + op.paramRef("#/components/parameters/summary"); + op.paramRef("#/components/parameters/format"); + op.paramRef("#/components/parameters/pretty"); + op.paramRef("#/components/parameters/elements"); } private void generateBatchTransaction(CapabilityStatementRestComponent csr) { @@ -405,7 +437,7 @@ public class OpenApiGenerator { 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"); + req.content("application/fhir+json").schemaRef(specRef()+"/fhir.schema.json#/definitions/Bundle"); if (isXml()) req.content("application/fhir+xml").schemaRef(specRef()+"/Bundle.xsd"); @@ -413,24 +445,24 @@ public class OpenApiGenerator { 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"); + resp.content("application/fhir+json").schemaRef(specRef()+"/fhir.schema.json#/definitions/Bundle"); if (isXml()) resp.content("application/fhir+xml").schemaRef(specRef()+"/Bundle.xsd"); - op.paramRef("#/Components/parameters/format"); - op.paramRef("#/Components/parameters/pretty"); + op.paramRef("#/components/parameters/format"); + op.paramRef("#/components/parameters/pretty"); } private void opOutcome(ResponseObjectWriter resp) { resp.description("Error, with details"); if (isJson()) - resp.content("application/fhir+json").schemaRef(specRef()+"/fhir.json.schema#/definitions/OperationOutcome"); + resp.content("application/fhir+json").schemaRef(specRef()+"/fhir.schema.json#/definitions/OperationOutcome"); if (isXml()) resp.content("application/fhir+xml").schemaRef(specRef()+"/OperationOutcome.xsd"); } private String specRef() { // todo: figure out which version we are running against - return "http://hl7.org/fhir/STU3"; + return "https://hl7.org/fhir/STU3"; } private boolean isJson() { diff --git a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/openapi/SchemaWriter.java b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/openapi/SchemaWriter.java index f10cb00f4..1aabe914c 100644 --- a/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/openapi/SchemaWriter.java +++ b/org.hl7.fhir.r5/src/main/java/org/hl7/fhir/r5/openapi/SchemaWriter.java @@ -18,7 +18,7 @@ public class SchemaWriter extends BaseWriter { switch (this) { case array: return "array"; case bool: return "boolean"; - case dateTime: return "dateTime"; + case dateTime: return "date-time"; case number: return "number"; case string: return "string"; } @@ -31,11 +31,23 @@ public class SchemaWriter extends BaseWriter { } public SchemaWriter type(SchemaType value) { - if (value != null) - object.addProperty("type", value.toCode()); + if (value != null) { + if (value == SchemaType.dateTime) { + object.addProperty("type", "string"); + object.addProperty("pattern", "([0-9]([0-9]([0-9][1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2][0-9]|3[0-1])(T([01][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)(\\.[0-9]+)?(Z|(\\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00)))?)?)?"); + + } else + object.addProperty("type", value.toCode()); + } return this; } + public SchemaWriter items() { + JsonObject items = new JsonObject(); + object.add("items", items); + return new SchemaWriter(items); + } + public SchemaWriter enums(String... values) { JsonArray arr = forceArray("enum"); for (String s : values) 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 index 1d1c72f92..3a129b1c9 100644 --- a/org.hl7.fhir.r5/src/main/resources/openapi/swagger-base.json +++ b/org.hl7.fhir.r5/src/main/resources/openapi/swagger-base.json @@ -1,6 +1,7 @@ { "openapi": "3.0.2", "info": { + "title": "Base FHIR Capability Statement (Full)", "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", @@ -28,12 +29,12 @@ "content": { "application/fhir+json": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/OperationOutcome" + "$ref": "https://hl7.org/fhir/STU3/fhir.schema.json#/definitions/OperationOutcome" } }, "application/fhir+xml": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/OperationOutcome.xsd" + "$ref": "https://hl7.org/fhir/STU3/OperationOutcome.xsd" } } } @@ -43,12 +44,12 @@ "content": { "application/fhir+json": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/CapabilityStatement" + "$ref": "https://hl7.org/fhir/STU3/fhir.schema.json#/definitions/CapabilityStatement" } }, "application/fhir+xml": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/CapabilityStatement.xsd" + "$ref": "https://hl7.org/fhir/STU3/CapabilityStatement.xsd" } } } @@ -56,16 +57,16 @@ }, "parameters": [ { - "$ref": "#/Components/parameters/format" + "$ref": "#/components/parameters/format" }, { - "$ref": "#/Components/parameters/pretty" + "$ref": "#/components/parameters/pretty" }, { - "$ref": "#/Components/parameters/summary" + "$ref": "#/components/parameters/summary" }, { - "$ref": "#/Components/parameters/elements" + "$ref": "#/components/parameters/elements" } ] } @@ -82,12 +83,12 @@ "content": { "application/fhir+json": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/OperationOutcome" + "$ref": "https://hl7.org/fhir/STU3/fhir.schema.json#/definitions/OperationOutcome" } }, "application/fhir+xml": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/OperationOutcome.xsd" + "$ref": "https://hl7.org/fhir/STU3/OperationOutcome.xsd" } } } @@ -97,12 +98,12 @@ "content": { "application/fhir+json": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/Bundle" + "$ref": "https://hl7.org/fhir/STU3/fhir.schema.json#/definitions/Bundle" } }, "application/fhir+xml": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/Bundle.xsd" + "$ref": "https://hl7.org/fhir/STU3/Bundle.xsd" } } } @@ -110,16 +111,16 @@ }, "parameters": [ { - "$ref": "#/Components/parameters/format" + "$ref": "#/components/parameters/format" }, { - "$ref": "#/Components/parameters/pretty" + "$ref": "#/components/parameters/pretty" }, { - "$ref": "#/Components/parameters/summary" + "$ref": "#/components/parameters/summary" }, { - "$ref": "#/Components/parameters/elements" + "$ref": "#/components/parameters/elements" }, { "name": "owner", @@ -142,7 +143,8 @@ "in": "query", "description": "Transaction window", "schema": { - "type": "dateTime" + "type": "string", + "pattern": "([0-9]([0-9]([0-9][1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2][0-9]|3[0-1])(T([01][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)(\\.[0-9]+)?(Z|(\\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00)))?)?)?" } }, { @@ -196,12 +198,12 @@ "content": { "application/fhir+json": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/Account" + "$ref": "https://hl7.org/fhir/STU3/fhir.schema.json#/definitions/Account" } }, "application/fhir+xml": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/Account.xsd" + "$ref": "https://hl7.org/fhir/STU3/Account.xsd" } } } @@ -212,12 +214,12 @@ "content": { "application/fhir+json": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/OperationOutcome" + "$ref": "https://hl7.org/fhir/STU3/fhir.schema.json#/definitions/OperationOutcome" } }, "application/fhir+xml": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/OperationOutcome.xsd" + "$ref": "https://hl7.org/fhir/STU3/OperationOutcome.xsd" } } } @@ -226,18 +228,21 @@ "description": "the resource being returned after being updated", "headers": { "ETag": { - "description": "Version from Resource.meta.version as a weak ETag" + "description": "Version from Resource.meta.version as a weak ETag", + "schema": { + "type": "string" + } } }, "content": { "application/fhir+json": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/Account" + "$ref": "https://hl7.org/fhir/STU3/fhir.schema.json#/definitions/Account" } }, "application/fhir+xml": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/Account.xsd" + "$ref": "https://hl7.org/fhir/STU3/Account.xsd" } } } @@ -245,16 +250,16 @@ }, "parameters": [ { - "$ref": "#/Components/parameters/summary" + "$ref": "#/components/parameters/summary" }, { - "$ref": "#/Components/parameters/format" + "$ref": "#/components/parameters/format" }, { - "$ref": "#/Components/parameters/pretty" + "$ref": "#/components/parameters/pretty" }, { - "$ref": "#/Components/parameters/elements" + "$ref": "#/components/parameters/elements" } ] } @@ -271,12 +276,12 @@ "content": { "application/fhir+json": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/OperationOutcome" + "$ref": "https://hl7.org/fhir/STU3/fhir.schema.json#/definitions/OperationOutcome" } }, "application/fhir+xml": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/OperationOutcome.xsd" + "$ref": "https://hl7.org/fhir/STU3/OperationOutcome.xsd" } } } @@ -285,18 +290,21 @@ "description": "the resource being returned", "headers": { "ETag": { - "description": "Version from Resource.meta.version as a weak ETag" + "description": "Version from Resource.meta.version as a weak ETag", + "schema": { + "type": "string" + } } }, "content": { "application/fhir+json": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/Account" + "$ref": "https://hl7.org/fhir/STU3/fhir.schema.json#/definitions/Account" } }, "application/fhir+xml": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/Account.xsd" + "$ref": "https://hl7.org/fhir/STU3/Account.xsd" } } } @@ -304,16 +312,19 @@ }, "parameters": [ { - "$ref": "#/Components/parameters/summary" + "$ref": "#/components/parameters/rid" }, { - "$ref": "#/Components/parameters/format" + "$ref": "#/components/parameters/summary" }, { - "$ref": "#/Components/parameters/pretty" + "$ref": "#/components/parameters/format" }, { - "$ref": "#/Components/parameters/elements" + "$ref": "#/components/parameters/pretty" + }, + { + "$ref": "#/components/parameters/elements" } ] }, @@ -326,12 +337,12 @@ "content": { "application/fhir+json": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/Account" + "$ref": "https://hl7.org/fhir/STU3/fhir.schema.json#/definitions/Account" } }, "application/fhir+xml": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/Account.xsd" + "$ref": "https://hl7.org/fhir/STU3/Account.xsd" } } } @@ -342,12 +353,12 @@ "content": { "application/fhir+json": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/OperationOutcome" + "$ref": "https://hl7.org/fhir/STU3/fhir.schema.json#/definitions/OperationOutcome" } }, "application/fhir+xml": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/OperationOutcome.xsd" + "$ref": "https://hl7.org/fhir/STU3/OperationOutcome.xsd" } } } @@ -356,18 +367,21 @@ "description": "the resource being returned after being updated", "headers": { "ETag": { - "description": "Version from Resource.meta.version as a weak ETag" + "description": "Version from Resource.meta.version as a weak ETag", + "schema": { + "type": "string" + } } }, "content": { "application/fhir+json": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/Account" + "$ref": "https://hl7.org/fhir/STU3/fhir.schema.json#/definitions/Account" } }, "application/fhir+xml": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/Account.xsd" + "$ref": "https://hl7.org/fhir/STU3/Account.xsd" } } } @@ -375,16 +389,19 @@ }, "parameters": [ { - "$ref": "#/Components/parameters/summary" + "$ref": "#/components/parameters/rid" }, { - "$ref": "#/Components/parameters/format" + "$ref": "#/components/parameters/summary" }, { - "$ref": "#/Components/parameters/pretty" + "$ref": "#/components/parameters/format" }, { - "$ref": "#/Components/parameters/elements" + "$ref": "#/components/parameters/pretty" + }, + { + "$ref": "#/components/parameters/elements" } ] }, @@ -397,12 +414,12 @@ "content": { "application/fhir+json": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/OperationOutcome" + "$ref": "https://hl7.org/fhir/STU3/fhir.schema.json#/definitions/OperationOutcome" } }, "application/fhir+xml": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/OperationOutcome.xsd" + "$ref": "https://hl7.org/fhir/STU3/OperationOutcome.xsd" } } } @@ -411,11 +428,19 @@ "description": "If the resource is deleted - no content is returned", "headers": { "ETag": { - "description": "Version from Resource.meta.version as a weak ETag" + "description": "Version from Resource.meta.version as a weak ETag", + "schema": { + "type": "string" + } } } } - } + }, + "parameters": [ + { + "$ref": "#/components/parameters/rid" + } + ] } }, "/Account/{rid}/_history": { @@ -430,12 +455,12 @@ "content": { "application/fhir+json": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/OperationOutcome" + "$ref": "https://hl7.org/fhir/STU3/fhir.schema.json#/definitions/OperationOutcome" } }, "application/fhir+xml": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/OperationOutcome.xsd" + "$ref": "https://hl7.org/fhir/STU3/OperationOutcome.xsd" } } } @@ -445,12 +470,12 @@ "content": { "application/fhir+json": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/Bundle" + "$ref": "https://hl7.org/fhir/STU3/fhir.schema.json#/definitions/Bundle" } }, "application/fhir+xml": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/Bundle.xsd" + "$ref": "https://hl7.org/fhir/STU3/Bundle.xsd" } } } @@ -458,31 +483,30 @@ }, "parameters": [ { - "$ref": "#/Components/parameters/summary" + "$ref": "#/components/parameters/rid" }, { - "$ref": "#/Components/parameters/format" + "$ref": "#/components/parameters/summary" }, { - "$ref": "#/Components/parameters/pretty" + "$ref": "#/components/parameters/format" }, { - "$ref": "#/Components/parameters/elements" + "$ref": "#/components/parameters/pretty" }, { - "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" - } + "$ref": "#/components/parameters/elements" + }, + { + "$ref": "#/components/parameters/count" }, { "name": "_since", "in": "query", "description": "Only include resource versions that were created at or after the given instant in time", "schema": { - "type": "dateTime" + "type": "string", + "pattern": "([0-9]([0-9]([0-9][1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2][0-9]|3[0-1])(T([01][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)(\\.[0-9]+)?(Z|(\\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00)))?)?)?" } }, { @@ -490,7 +514,8 @@ "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" + "type": "string", + "pattern": "([0-9]([0-9]([0-9][1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2][0-9]|3[0-1])(T([01][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)(\\.[0-9]+)?(Z|(\\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00)))?)?)?" } }, { @@ -516,12 +541,12 @@ "content": { "application/fhir+json": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/OperationOutcome" + "$ref": "https://hl7.org/fhir/STU3/fhir.schema.json#/definitions/OperationOutcome" } }, "application/fhir+xml": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/OperationOutcome.xsd" + "$ref": "https://hl7.org/fhir/STU3/OperationOutcome.xsd" } } } @@ -530,18 +555,21 @@ "description": "the resource being returned", "headers": { "ETag": { - "description": "Version from Resource.meta.version as a weak ETag for that version" + "description": "Version from Resource.meta.version as a weak ETag for that version", + "schema": { + "type": "string" + } } }, "content": { "application/fhir+json": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/Account" + "$ref": "https://hl7.org/fhir/STU3/fhir.schema.json#/definitions/Account" } }, "application/fhir+xml": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/Account.xsd" + "$ref": "https://hl7.org/fhir/STU3/Account.xsd" } } } @@ -549,16 +577,22 @@ }, "parameters": [ { - "$ref": "#/Components/parameters/summary" + "$ref": "#/components/parameters/rid" }, { - "$ref": "#/Components/parameters/format" + "$ref": "#/components/parameters/hid" }, { - "$ref": "#/Components/parameters/pretty" + "$ref": "#/components/parameters/summary" }, { - "$ref": "#/Components/parameters/elements" + "$ref": "#/components/parameters/format" + }, + { + "$ref": "#/components/parameters/pretty" + }, + { + "$ref": "#/components/parameters/elements" } ] } @@ -568,19 +602,19 @@ "description": "Access to previous versions of resourcez of type Account", "get": { "summary": "Read the past states of the resource", - "operationId": "histinstAccount", + "operationId": "histtypeAccount", "responses": { "default": { "description": "Error, with details", "content": { "application/fhir+json": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/OperationOutcome" + "$ref": "https://hl7.org/fhir/STU3/fhir.schema.json#/definitions/OperationOutcome" } }, "application/fhir+xml": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/OperationOutcome.xsd" + "$ref": "https://hl7.org/fhir/STU3/OperationOutcome.xsd" } } } @@ -590,12 +624,12 @@ "content": { "application/fhir+json": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/Bundle" + "$ref": "https://hl7.org/fhir/STU3/fhir.schema.json#/definitions/Bundle" } }, "application/fhir+xml": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/Bundle.xsd" + "$ref": "https://hl7.org/fhir/STU3/Bundle.xsd" } } } @@ -603,31 +637,27 @@ }, "parameters": [ { - "$ref": "#/Components/parameters/summary" + "$ref": "#/components/parameters/summary" }, { - "$ref": "#/Components/parameters/format" + "$ref": "#/components/parameters/format" }, { - "$ref": "#/Components/parameters/pretty" + "$ref": "#/components/parameters/pretty" }, { - "$ref": "#/Components/parameters/elements" + "$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" - } + "$ref": "#/components/parameters/count" }, { "name": "_since", "in": "query", "description": "Only include resource versions that were created at or after the given instant in time", "schema": { - "type": "dateTime" + "type": "string", + "pattern": "([0-9]([0-9]([0-9][1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2][0-9]|3[0-1])(T([01][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)(\\.[0-9]+)?(Z|(\\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00)))?)?)?" } }, { @@ -635,7 +665,8 @@ "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" + "type": "string", + "pattern": "([0-9]([0-9]([0-9][1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2][0-9]|3[0-1])(T([01][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)(\\.[0-9]+)?(Z|(\\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00)))?)?)?" } }, { @@ -654,19 +685,19 @@ "description": "Access a previous versions of all types", "get": { "summary": "Read the past states of all resources", - "operationId": "histinstAll", + "operationId": "histAll", "responses": { "default": { "description": "Error, with details", "content": { "application/fhir+json": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/OperationOutcome" + "$ref": "https://hl7.org/fhir/STU3/fhir.schema.json#/definitions/OperationOutcome" } }, "application/fhir+xml": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/OperationOutcome.xsd" + "$ref": "https://hl7.org/fhir/STU3/OperationOutcome.xsd" } } } @@ -676,12 +707,12 @@ "content": { "application/fhir+json": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/Bundle" + "$ref": "https://hl7.org/fhir/STU3/fhir.schema.json#/definitions/Bundle" } }, "application/fhir+xml": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/Bundle.xsd" + "$ref": "https://hl7.org/fhir/STU3/Bundle.xsd" } } } @@ -689,31 +720,27 @@ }, "parameters": [ { - "$ref": "#/Components/parameters/summary" + "$ref": "#/components/parameters/summary" }, { - "$ref": "#/Components/parameters/format" + "$ref": "#/components/parameters/format" }, { - "$ref": "#/Components/parameters/pretty" + "$ref": "#/components/parameters/pretty" }, { - "$ref": "#/Components/parameters/elements" + "$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" - } + "$ref": "#/components/parameters/count" }, { "name": "_since", "in": "query", "description": "Only include resource versions that were created at or after the given instant in time", "schema": { - "type": "dateTime" + "type": "string", + "pattern": "([0-9]([0-9]([0-9][1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2][0-9]|3[0-1])(T([01][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)(\\.[0-9]+)?(Z|(\\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00)))?)?)?" } }, { @@ -721,7 +748,8 @@ "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" + "type": "string", + "pattern": "([0-9]([0-9]([0-9][1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2][0-9]|3[0-1])(T([01][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)(\\.[0-9]+)?(Z|(\\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00)))?)?)?" } }, { @@ -747,12 +775,12 @@ "content": { "application/fhir+json": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/OperationOutcome" + "$ref": "https://hl7.org/fhir/STU3/fhir.schema.json#/definitions/OperationOutcome" } }, "application/fhir+xml": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/OperationOutcome.xsd" + "$ref": "https://hl7.org/fhir/STU3/OperationOutcome.xsd" } } } @@ -762,12 +790,12 @@ "content": { "application/fhir+json": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/Bundle" + "$ref": "https://hl7.org/fhir/STU3/fhir.schema.json#/definitions/Bundle" } }, "application/fhir+xml": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/Bundle.xsd" + "$ref": "https://hl7.org/fhir/STU3/Bundle.xsd" } } } @@ -775,16 +803,16 @@ }, "parameters": [ { - "$ref": "#/Components/parameters/format" + "$ref": "#/components/parameters/format" }, { - "$ref": "#/Components/parameters/pretty" + "$ref": "#/components/parameters/pretty" }, { - "$ref": "#/Components/parameters/summary" + "$ref": "#/components/parameters/summary" }, { - "$ref": "#/Components/parameters/elements" + "$ref": "#/components/parameters/elements" }, { "name": "_text", @@ -856,116 +884,6 @@ "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", @@ -1003,7 +921,8 @@ "in": "query", "description": "When the resource version last changed", "schema": { - "type": "dateTime" + "type": "string", + "pattern": "([0-9]([0-9]([0-9][1-9]|[1-9]0)|[1-9]00)|[1-9]000)(-(0[1-9]|1[0-2])(-(0[1-9]|[1-2][0-9]|3[0-1])(T([01][0-9]|2[0-3]):[0-5][0-9]:([0-5][0-9]|60)(\\.[0-9]+)?(Z|(\\+|-)((0[0-9]|1[0-3]):[0-5][0-9]|14:00)))?)?)?" } }, { @@ -1045,100 +964,6 @@ "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" - } } ] }, @@ -1151,12 +976,12 @@ "content": { "application/fhir+json": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/Bundle" + "$ref": "https://hl7.org/fhir/STU3/fhir.schema.json#/definitions/Bundle" } }, "application/fhir+xml": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/Bundle.xsd" + "$ref": "https://hl7.org/fhir/STU3/Bundle.xsd" } } } @@ -1167,12 +992,12 @@ "content": { "application/fhir+json": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/OperationOutcome" + "$ref": "https://hl7.org/fhir/STU3/fhir.schema.json#/definitions/OperationOutcome" } }, "application/fhir+xml": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/OperationOutcome.xsd" + "$ref": "https://hl7.org/fhir/STU3/OperationOutcome.xsd" } } } @@ -1182,12 +1007,12 @@ "content": { "application/fhir+json": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/Bundle" + "$ref": "https://hl7.org/fhir/STU3/fhir.schema.json#/definitions/Bundle" } }, "application/fhir+xml": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/Bundle.xsd" + "$ref": "https://hl7.org/fhir/STU3/Bundle.xsd" } } } @@ -1195,10 +1020,10 @@ }, "parameters": [ { - "$ref": "#/Components/parameters/format" + "$ref": "#/components/parameters/format" }, { - "$ref": "#/Components/parameters/pretty" + "$ref": "#/components/parameters/pretty" } ] } @@ -1206,63 +1031,88 @@ }, "components": { "parameters": { + "rid": { + "name": "rid", + "in": "path", + "description": "id of the resource (\u003dResource.id)", + "required": true, + "allowEmptyValue": false, + "style": "simple", + "schema": { + "type": "string" + } + }, + "hid": { + "name": "hid", + "in": "path", + "description": "id of the history entry (\u003dResource.meta.versionId)", + "required": true, + "allowEmptyValue": false, + "style": "simple", + "schema": { + "type": "string" + } + }, "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" - ] - } + "name": "_summary", + "in": "query", + "description": "Requests the server to return a designated subset of the resource", + "allowEmptyValue": true, + "style": "form", + "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" - } + "name": "_format", + "in": "query", + "description": "Specify alternative response formats by their MIME-types (when a client is unable acccess accept: header)", + "allowEmptyValue": true, + "style": "form", + "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" - } + "name": "_pretty", + "in": "query", + "description": "Ask for a pretty printed response for human convenience", + "allowEmptyValue": true, + "style": "form", + "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", + "name": "_elements", + "in": "query", + "description": "Requests the server to return a collection of elements from the resource", + "allowEmptyValue": true, + "style": "form", + "explode": false, + "schema": { + "type": "array", + "format": "string", + "items": { "format": "string" } } + }, + "count": { + "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" + } } } } 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 index c6567a4c8..f513ac4d6 100644 --- a/org.hl7.fhir.r5/src/main/resources/openapi/swagger-base2.json +++ b/org.hl7.fhir.r5/src/main/resources/openapi/swagger-base2.json @@ -1,6 +1,7 @@ { "openapi": "3.0.2", "info": { + "title": "Base FHIR Capability Statement (Empty)", "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", @@ -28,12 +29,12 @@ "content": { "application/fhir+json": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/OperationOutcome" + "$ref": "https://hl7.org/fhir/STU3/fhir.schema.json#/definitions/OperationOutcome" } }, "application/fhir+xml": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/OperationOutcome.xsd" + "$ref": "https://hl7.org/fhir/STU3/OperationOutcome.xsd" } } } @@ -43,12 +44,12 @@ "content": { "application/fhir+json": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/fhir.json.schema#/definitions/CapabilityStatement" + "$ref": "https://hl7.org/fhir/STU3/fhir.schema.json#/definitions/CapabilityStatement" } }, "application/fhir+xml": { "schema": { - "$ref": "http://hl7.org/fhir/STU3/CapabilityStatement.xsd" + "$ref": "https://hl7.org/fhir/STU3/CapabilityStatement.xsd" } } } @@ -56,16 +57,16 @@ }, "parameters": [ { - "$ref": "#/Components/parameters/format" + "$ref": "#/components/parameters/format" }, { - "$ref": "#/Components/parameters/pretty" + "$ref": "#/components/parameters/pretty" }, { - "$ref": "#/Components/parameters/summary" + "$ref": "#/components/parameters/summary" }, { - "$ref": "#/Components/parameters/elements" + "$ref": "#/components/parameters/elements" } ] } @@ -73,63 +74,88 @@ }, "components": { "parameters": { + "rid": { + "name": "rid", + "in": "path", + "description": "id of the resource (\u003dResource.id)", + "required": true, + "allowEmptyValue": false, + "style": "simple", + "schema": { + "type": "string" + } + }, + "hid": { + "name": "hid", + "in": "path", + "description": "id of the history entry (\u003dResource.meta.versionId)", + "required": true, + "allowEmptyValue": false, + "style": "simple", + "schema": { + "type": "string" + } + }, "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" - ] - } + "name": "_summary", + "in": "query", + "description": "Requests the server to return a designated subset of the resource", + "allowEmptyValue": true, + "style": "form", + "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" - } + "name": "_format", + "in": "query", + "description": "Specify alternative response formats by their MIME-types (when a client is unable acccess accept: header)", + "allowEmptyValue": true, + "style": "form", + "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" - } + "name": "_pretty", + "in": "query", + "description": "Ask for a pretty printed response for human convenience", + "allowEmptyValue": true, + "style": "form", + "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", + "name": "_elements", + "in": "query", + "description": "Requests the server to return a collection of elements from the resource", + "allowEmptyValue": true, + "style": "form", + "explode": false, + "schema": { + "type": "array", + "format": "string", + "items": { "format": "string" } } + }, + "count": { + "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" + } } } }