Skip to content

Commit

Permalink
Added ErrorResource, BatchResult, removed collections
Browse files Browse the repository at this point in the history
  • Loading branch information
cookeac committed Jul 1, 2021
1 parent 325e9b6 commit a040753
Show file tree
Hide file tree
Showing 4 changed files with 136 additions and 46 deletions.
32 changes: 8 additions & 24 deletions resources/exampleErrorResource.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"description": "An extention to a RFC7807 compliant problem response for JSON APIs",
"description": "An extension to an (almost) RFC7807 compliant problem response for JSON APIs.",

"type": "object",

"properties": {
"type": {
"id": {
"type": "string",
"format": "uri",
"description": "Machine readable URI that uniquely defines the problem."
"description": "Machine readable URI that uniquely defines the problem (this field should really be called 'type')."
},
"status": {
"type": "integer",
"description": "The HTTP status code applicable to this problem",
"format": "int32"
"description": "The HTTP status code applicable to this problem.",
"format": "int32",
"nullable": true
},
"title": {
"type": "string",
Expand All @@ -24,24 +24,8 @@
},
"instance": {
"type": "string",
"description": "A URI reference or internal JSON document reference to the specific data resource that caused the problem."
},
"instanceIdentification": {
"type": "object",
"properties": {
"source": {
"type": "string",
"description": "Identifies the source of the resource as contained in the resource metadata."
},
"sourceId": {
"type": "string",
"description": "Identifies the resource using its source identifier as contained in the resource metadata."
},
"hostId": {
"type": "string",
"description": "If specified, identifies the resource with a unique Id (UUID) in the host system."
}
}
"description": "A URI reference or internal JSON document reference to the specific data item that caused the problem.",
"nullable": true
}
}
}
30 changes: 30 additions & 0 deletions resources/icarBatchResult.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"description": "Returned by a batch POST event to return identity (meta), errors, and warnings for a resource.",
"type": "object",
"properties": {
"id": {
"type": "string",
"description": "Unique identifier created in the system for this event. SHOULD be a UUID."
},
"meta": {
"$ref": "../types/icarMetaDataType.json",
"description": "Metadata for the posted resource. Allows specification of the source, source Id to synchronise data."
},
"errors": {
"type": "array",
"description": "An arry of errors for this resource.",
"nullable": true,
"items": {
"$ref": "../resources/icarErrorResource.json"
}
},
"warnings": {
"type": "array",
"description": "An arry of warnings for this resource.",
"nullable": true,
"items": {
"$ref": "../resources/icarErrorResource.json"
}
}
}
}
31 changes: 31 additions & 0 deletions resources/icarErrorResource.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"description": "An RFC7807 compliant problem response for JSON APIs.",

"type": "object",

"properties": {
"type": {
"type": "string",
"description": "Machine readable URI or code that defines the type of error or warning."
},
"status": {
"type": "integer",
"description": "The HTTP status code applicable to this problem.",
"format": "int32",
"nullable": true
},
"title": {
"type": "string",
"description": "A short, human-readable summary of the problem that SHOULD NOT change from occurrence to occurrence of the problem, except for purposes of localization."
},
"detail": {
"type": "string",
"description": "A human-readable explanation specific to this occurrence of the problem. Like title, this field’s value can be localized."
},
"instance": {
"type": "string",
"description": "A URI reference or internal JSON document reference to the specific data item that caused the problem.",
"nullable": true
}
}
}
89 changes: 67 additions & 22 deletions url-schemes/healthURLScheme.json
Original file line number Diff line number Diff line change
Expand Up @@ -319,35 +319,35 @@
],
"requestBody": {
"required": true,
"description": "The collection of health diagnosis events to create. \nA client MAY fill in resource *Id*s with a client-generated UUID and the server MAY use these *Id*s.\nIf the server does not use the client-specified *Id* field it shall issue its own *Id*s for the resources.\nA client SHALL ensure that the *meta.source* and *meta.sourceId* fields are filled by the client.\nAlthough a collection is used, servers SHALL IGNORE any pagination-related attributes.\n",
"description": "The collection of health diagnosis events to create. \nA client MAY fill in resource *Id*s with a client-generated UUID and the server MAY use these *Id*s.\nIf the server does not use the client-specified *Id* field it shall issue its own *Id*s for the resources.\nA client SHALL ensure that the *meta.source* and *meta.sourceId* fields are filled by the client.\n",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/icarDiagnosisEventCollection"
"$ref": "#/components/schemas/icarDiagnosisEventArray"
}
}
}
},
"responses": {
"200": {
"description": "Successful. The response contains a copy of the collection, as modifed by the server.",
"description": "Successful. The response contains a set of batch results, which may include warnings.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/icarDiagnosisEventCollection"
"$ref": "#/components/schemas/batchResults"
}
}
}
},
"201": {
"description": "Created. The Location header contains the URI to the collection, as modified by the server.",
"description": "Created. The Location header contains URI to retrieve a set of batch results, which may include warnings.",
"headers": {
"Location": {
"schema": {
"type": "string",
"format": "uri"
},
"description": "Contains the URI to the new resource."
"description": "Contains the URI to the results."
}
}
},
Expand All @@ -364,7 +364,14 @@
}
},
"default": {
"$ref": "#/components/responses/default"
"description": "The response contains a set of batch results, which may include errors and warnings.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/batchResults"
}
}
}
}
}
}
Expand All @@ -387,35 +394,35 @@
],
"requestBody": {
"required": true,
"description": "The collection of health treatment events to create. \nA client MAY fill in resource *Id*s with a client-generated UUID and the server MAY use these *Id*s.\nIf the server does not use the client-specified *Id* field it shall issue its own *Id*s for the resources.\nA client SHALL ensure that the *meta.source* and *meta.sourceId* fields are filled by the client.\nAlthough a collection is used, servers SHALL IGNORE any pagination-related attributes.\n",
"description": "The collection of health treatment events to create. \nA client MAY fill in resource *Id*s with a client-generated UUID and the server MAY use these *Id*s.\nIf the server does not use the client-specified *Id* field it shall issue its own *Id*s for the resources.\nA client SHALL ensure that the *meta.source* and *meta.sourceId* fields are filled by the client.\n",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/icarTreatmentEventCollection"
"$ref": "#/components/schemas/icarTreatmentEventArray"
}
}
}
},
"responses": {
"200": {
"description": "Successful. The response contains a copy of the collection, as modifed by the server.",
"description": "Successful. The response contains a set of batch results, which may include warnings.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/icarDiagnosisEventCollection"
"$ref": "#/components/schemas/batchResults"
}
}
}
},
"201": {
"description": "Created. The Location header contains the URI to the collection, as modified by the server.",
"description": "Created. The Location header contains URI to retrieve a set of batch results, which may include warnings.",
"headers": {
"Location": {
"schema": {
"type": "string",
"format": "uri"
},
"description": "Contains the URI to a collection of new resources."
"description": "Contains the URI to the results."
}
}
},
Expand All @@ -432,7 +439,14 @@
}
},
"default": {
"$ref": "#/components/responses/default"
"description": "The response contains a set of batch results, which may include errors and warnings.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/batchResults"
}
}
}
}
}
}
Expand All @@ -455,35 +469,35 @@
],
"requestBody": {
"required": true,
"description": "The collection of health treatment program events to create. \nA client MAY fill in resource *Id*s with a client-generated UUID and the server MAY use these *Id*s.\nIf the server does not use the client-specified *Id* field it shall issue its own *Id*s for the resources.\nA client SHALL ensure that the *meta.source* and *meta.sourceId* fields are filled by the client.\nAlthough a collection is used, servers SHALL IGNORE any pagination-related attributes.\n",
"description": "The collection of health treatment program events to create. \nA client MAY fill in resource *Id*s with a client-generated UUID and the server MAY use these *Id*s.\nIf the server does not use the client-specified *Id* field it shall issue its own *Id*s for the resources.\nA client SHALL ensure that the *meta.source* and *meta.sourceId* fields are filled by the client.\n",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/icarTreatmentProgramEventCollection"
"$ref": "#/components/schemas/icarTreatmentProgramEventArray"
}
}
}
},
"responses": {
"200": {
"description": "Successful. The response contains a copy of the collection, as modifed by the server.",
"description": "Successful. The response contains a set of batch results, which may include warnings.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/icarTreatmentProgramEventCollection"
"$ref": "#/components/schemas/batchResults"
}
}
}
},
"201": {
"description": "Created. The Location header contains the URI to the collection, as modified by the server.",
"description": "Created. The Location header contains URI to retrieve a set of batch results, which may include warnings.",
"headers": {
"Location": {
"schema": {
"type": "string",
"format": "uri"
},
"description": "Contains the URI to a collection of new resources."
"description": "Contains the URI to the results."
}
}
},
Expand All @@ -500,34 +514,65 @@
}
},
"default": {
"$ref": "#/components/responses/default"
"description": "The response contains a set of batch results, which may include errors and warnings.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/batchResults"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"batchResults": {
"type": "array",
"items": {
"$ref": "../resources/icarBatchResult.json"
}
},
"error": {
"$ref": "../resources/exampleErrorResource.json"
"$ref": "../resources/icarErrorResource.json"
},
"icarDiagnosisEvent": {
"$ref": "../resources/icarDiagnosisEventResource.json"
},
"icarDiagnosisEventCollection": {
"$ref": "../collections/icarDiagnosisEventCollection.json"
},
"icarDiagnosisEventArray": {
"type": "array",
"items": {
"$ref": "../resources/icarDiagnosisEventResource.json"
}
},
"icarTreatmentEvent": {
"$ref": "../resources/icarTreatmentEventResource.json"
},
"icarTreatmentEventCollection": {
"$ref": "../collections/icarTreatmentEventCollection.json"
},
"icarTreatmentEventArray": {
"type": "array",
"items": {
"$ref": "../resources/icarTreatmentEventResource.json"
}
},
"icarTreatmentProgramEvent": {
"$ref": "../resources/icarTreatmentProgramEventResource.json"
},
"icarTreatmentProgramEventCollection": {
"$ref": "../collections/icarTreatmentProgramEventCollection.json"
},
"icarTreatmentProgramEventArray": {
"type": "array",
"items": {
"$ref": "../resources/icarTreatmentProgramEventResource.json"
}
}
},
"parameters": {
Expand Down

0 comments on commit a040753

Please sign in to comment.