From d65436b1cfd32f7cd11d1d94ab53f03dc3895db3 Mon Sep 17 00:00:00 2001 From: Anton Hokkonen Date: Thu, 12 Dec 2019 19:51:32 +0200 Subject: [PATCH 1/3] UrlScheme structure normalization/optimization - moved common request parameters under "components/parameter" -section for easier reusing, updated parameter references - moved event schemas definitions under "components/schemas" -section for easier maintenance - moved examples under "components/examples" -section for easier maintenance - moved default response under "components/responses" -section for easier maintenance - small refactoring for capital letters in endpint names --- .../exampleUrlScheme.json | 1173 ++++++----------- 1 file changed, 383 insertions(+), 790 deletions(-) diff --git a/Release Candidate Messages/exampleUrlScheme.json b/Release Candidate Messages/exampleUrlScheme.json index 49792b0..1715183 100644 --- a/Release Candidate Messages/exampleUrlScheme.json +++ b/Release Candidate Messages/exampleUrlScheme.json @@ -38,144 +38,37 @@ "get": { "operationId": "get-milking-visits", "summary": "Get the data for milking visits", - "description": "# Purpose\nProvides data from visits of animals to a milking parlour.\n \nThis comprises all posible data. Anybody can choose to define API's that return less information in the response.\n", + "description": "# Purpose\nProvides data from visits of animals to a milking parlour.\n \nThis comprises all possible data. Anybody can choose to define API's that return less information in the response.\n", "tags": [ "release-candidate-milk" ], "parameters": [ - { - "name": "location-scheme", - "in": "path", - "description": "The scheme id for the location identifier.", - "required": true, - "schema": { - "type": "string", - "enum": [ - "nl.ubn", - "de.farmid", - "be.pen" - ] - } - }, - { - "name": "location-id", - "in": "path", - "description": "The unique identifier for the location.", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "start-date-time", - "in": "query", - "description": "The start of the date-time range for the data to get in the request.", - "schema": { - "type": "string", - "format": "date-time" - } - }, - { - "name": "end-date-time", - "in": "query", - "description": "The end of the date-time range for the data to get in the request.", - "schema": { - "type": "string", - "format": "date-time" - } - } + { "$ref": "#/components/parameters/location-scheme" }, + { "$ref": "#/components/parameters/location-id" }, + { "$ref": "#/components/parameters/start-date-time" }, + { "$ref": "#/components/parameters/end-date-time" } ], "responses": { "200": { "description": "Successful. The response contains the milking results for the given location", "content": { "application/json": { - "schema": { + "schema": { "type": "array", "items": { - "$ref": "icarMilkingVisitEventResource.json" + "$ref": "#/components/schemas/milking-visit" } }, - "examples": { - "response": { - "value": { - "id": "706250", - "animal": { - "id": "NL 877034232", - "scheme": "nl-v1" - }, - "milkingStartingDateTime": "2019-11-01T23:58:31", - "milkingVisitDuration": { - "value": 349.0, - "unitCode": "SEC" - }, - "milkingDuration": { - "value": "210", - "unitCode": "SEC" - }, - "milkingType": "Automated", - "milkingMilkWeight": { - "value": 3.5, - "unitCode": "KGM" - }, - "milkingComplete": true, - "milkingParlourUnit": "101", - "milkingBoxNumber": 0, - "milkingDeviceId": "101", - "measureDeviceId": "101", - "eventOffset": "2019-11-01T23:58:31", - "eventDeviceId": "101", - "quarterMilkings": [ { - "icarQuarterId": "LF", - "milkingDuration": { - "value": "210", - "unitCode": "SEC" - }, - "milkingMilkWeight": { - "value": 3.5, - "unitCode": "KGM" - } - } ], - "animalMilkingSample": [ { - "bottleIdentifierType": "BRC", - "rackNumber": "3", - "bottlePosition": "7" - } ], - "icarMilkCharacteristics": [ { - "characteristic": "FAT", - "value": "3.74", - "unit": "VP", - "icarMeasuringDevice": "to_be_defined_by_ICAR-sensor_group" - }, - { - "characteristic": "PROTEIN", - "value": "3.54", - "unit": "VP" - } ] - } + "examples": { + "objectExample": { + "$ref": "#/components/examples/milking-visit" } } } } }, "default": { - "description": "An error has occured while handling the request. Check the content of the message for the error details.", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "errors": { - "type": "array", - "items": { - "$ref": "#/components/schemas/error" - } - } - }, - "description": "A default response containing only a list of errors" - } - } - } + "$ref": "#/components/responses/default" } } } @@ -183,116 +76,38 @@ "/locations/{location-scheme}/{location-id}/test-day-results": { "get": { "operationId": "get-test-day-results", - "summary": "Get the data for test days", + "summary": "Get the data for test day results", "description": "# Purpose\nProvides data from the test day for animals on a farm\n", "tags": [ "release-candidate-milk" ], "parameters": [ - { - "name": "location-scheme", - "in": "path", - "description": "The scheme id for the location identifier.", - "required": true, - "schema": { - "type": "string", - "enum": [ - "nl.ubn", - "de.farmid", - "be.pen" - ] - } - }, - { - "name": "location-id", - "in": "path", - "description": "The unique identifier for the location.", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "start-date-time", - "in": "query", - "description": "The start of the date-time range for the data to get in the request.", - "schema": { - "type": "string", - "format": "date-time" - } - }, - { - "name": "end-date-time", - "in": "query", - "description": "The end of the date-time range for the data to get in the request.", - "schema": { - "type": "string", - "format": "date-time" - } - } + { "$ref": "#/components/parameters/location-scheme" }, + { "$ref": "#/components/parameters/location-id" }, + { "$ref": "#/components/parameters/start-date-time" }, + { "$ref": "#/components/parameters/end-date-time" } ], "responses": { "200": { "description": "Successful. The response contains the test day results for the given location", "content": { "application/json": { - "schema": { + "schema": { "type": "array", "items": { - "$ref": "icarTestDayResource.json" + "$ref": "#/components/schemas/test-day-result" } }, - "examples": { - "response": { - "value": { - "id": "706250", - "animal": { - "id": "NL 877034232", - "scheme": "nl-v1" - }, - "EventDateTime": "2019-11-01T23:58:31", - "milkWeight24Hours": { - "value": "21.7", - "unitCode": "KGM" - }, - "testDayCode": "0", - "icarMilkCharacteristics": [ - { - "characteristic": "FAT", - "value": "3.74", - "unit": "VP", - "icarMeasuringDevice": "to_be_defined_by_ICAR-sensor_group" - }, - { - "characteristic": "PROTEIN", - "value": "3.54", - "unit": "VP" - } - ] - } + "examples": { + "objectExample": { + "$ref": "#/components/examples/test-day-result" } } } } }, "default": { - "description": "An error has occured while handling the request. Check the content of the message for the error details.", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "errors": { - "type": "array", - "items": { - "$ref": "#/components/schemas/error" - } - } - }, - "description": "A default response containing only a list of errors" - } - } - } + "$ref": "#/components/responses/default" } } } @@ -306,80 +121,27 @@ "release-candidate-registration" ], "parameters": [ - { - "name": "location-scheme", - "in": "path", - "description": "The scheme id for the location identifier.", - "required": true, - "schema": { - "type": "string", - "enum": [ - "nl.ubn", - "de.farmid", - "be.pen" - ] - } - }, - { - "name": "location-id", - "in": "path", - "description": "The unique identifier for the location.", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "start-date-time", - "in": "query", - "description": "The start of the date-time range for the data to get in the request.", - "schema": { - "type": "string", - "format": "date-time" - } - }, - { - "name": "end-date-time", - "in": "query", - "description": "The end of the date-time range for the data to get in the request.", - "schema": { - "type": "string", - "format": "date-time" - } - } + { "$ref": "#/components/parameters/location-scheme" }, + { "$ref": "#/components/parameters/location-id" }, + { "$ref": "#/components/parameters/start-date-time" }, + { "$ref": "#/components/parameters/end-date-time" } ], "responses": { "200": { "description": "Successful. The response contains the births for the given location", "content": { "application/json": { - "schema": { + "schema": { "type": "array", "items": { - "$ref": "icarMovementBirthEventResource.json" + "$ref": "#/components/schemas/birth" } } } } }, "default": { - "description": "An error has occured while handling the request. Check the content of the message for the error details.", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "errors": { - "type": "array", - "items": { - "$ref": "#/components/schemas/error" - } - } - }, - "description": "A default response containing only a list of errors" - } - } - } + "$ref": "#/components/responses/default" } } } @@ -393,80 +155,27 @@ "release-candidate-registration" ], "parameters": [ - { - "name": "location-scheme", - "in": "path", - "description": "The scheme id for the location identifier.", - "required": true, - "schema": { - "type": "string", - "enum": [ - "nl.ubn", - "de.farmid", - "be.pen" - ] - } - }, - { - "name": "location-id", - "in": "path", - "description": "The unique identifier for the location.", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "start-date-time", - "in": "query", - "description": "The start of the date-time range for the data to get in the request.", - "schema": { - "type": "string", - "format": "date-time" - } - }, - { - "name": "end-date-time", - "in": "query", - "description": "The end of the date-time range for the data to get in the request.", - "schema": { - "type": "string", - "format": "date-time" - } - } + { "$ref": "#/components/parameters/location-scheme" }, + { "$ref": "#/components/parameters/location-id" }, + { "$ref": "#/components/parameters/start-date-time" }, + { "$ref": "#/components/parameters/end-date-time" } ], "responses": { "200": { "description": "Successful. The response contains the died animals for the given location", "content": { "application/json": { - "schema": { + "schema": { "type": "array", "items": { - "$ref": "icarMovementDeathEventResource.json" + "$ref": "#/components/schemas/death" } } } } }, "default": { - "description": "An error has occured while handling the request. Check the content of the message for the error details.", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "errors": { - "type": "array", - "items": { - "$ref": "#/components/schemas/error" - } - } - }, - "description": "A default response containing only a list of errors" - } - } - } + "$ref": "#/components/responses/default" } } } @@ -480,147 +189,32 @@ "release-candidate-registration" ], "parameters": [ - { - "name": "location-scheme", - "in": "path", - "description": "The scheme id for the location identifier.", - "required": true, - "schema": { - "type": "string", - "enum": [ - "nl.ubn", - "de.farmid", - "be.pen" - ] - } - }, - { - "name": "location-id", - "in": "path", - "description": "The unique identifier for the location.", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "start-date-time", - "in": "query", - "description": "The start of the date-time range for the data to get in the request.", - "schema": { - "type": "string", - "format": "date-time" - } - }, - { - "name": "end-date-time", - "in": "query", - "description": "The end of the date-time range for the data to get in the request.", - "schema": { - "type": "string", - "format": "date-time" - } - } + { "$ref": "#/components/parameters/location-scheme" }, + { "$ref": "#/components/parameters/location-id" }, + { "$ref": "#/components/parameters/start-date-time" }, + { "$ref": "#/components/parameters/end-date-time" } ], "responses": { "200": { "description": "Successful. The response contains the arrived animals for the given location", "content": { "application/json": { - "schema": { + "schema": { "type": "array", "items": { - "$ref": "icarMovementArrivalEventResource.json" + "$ref": "#/components/schemas/arrival" } }, - "examples": { - "response": { - "value": { - "id": "ac9bdd26-0e20-44e7-b311-7d3d988f9717", - "animal": { - "id": "NL 919713288", - "scheme": "nl.ubn" - }, - "eventDateTime": "2016-01-06", - "location": { - "id": "231817", - "scheme": "nl.ubn" - }, - "animalDetail": { - "alternativeIdentifiers": [], - "species": "Cattle", - "gender": "Female", - "birthDate": "2013-11-06", - "breedFractions": { - "denominator": "8", - "fractions": [ - { - "breed": { - "id": "HF", - "scheme": "icar.org" - }, - "fraction": "8" - } - ] - }, - "coatColor": "RB", - "managementTag": "88", - "name": "NELLY 258", - "productionPurpose": "Milk", - "status": "Alive", - "parentage": [ - { - "parentOf": { - "id": "NL 919713288", - "scheme": "nl.ubn" - }, - "gender": "Female", - "relation": "Genetic", - "identifier": { - "id": "NL 765410142", - "scheme": "nl.ubn" - }, - "officialName": "NELLY 211" - }, - { - "parentOf": { - "id": "NL 919713288", - "scheme": "nl.ubn" - }, - "gender": "Male", - "relation": "Genetic", - "identifier": { - "id": "NL 399745212", - "scheme": "nl.ubn" - }, - "officialName": "TOPSPEED KODAK" - } - ] - } - } + "examples": { + "objectExample": { + "$ref": "#/components/examples/arrival" } } } } }, "default": { - "description": "An error has occured while handling the request. Check the content of the message for the error details.", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "errors": { - "type": "array", - "items": { - "$ref": "#/components/schemas/error" - } - } - }, - "description": "A default response containing only a list of errors" - } - } - } + "$ref": "#/components/responses/default" } } } @@ -634,80 +228,27 @@ "release-candidate-registration" ], "parameters": [ - { - "name": "location-scheme", - "in": "path", - "description": "The scheme id for the location identifier.", - "required": true, - "schema": { - "type": "string", - "enum": [ - "nl.ubn", - "de.farmid", - "be.pen" - ] - } - }, - { - "name": "location-id", - "in": "path", - "description": "The unique identifier for the location.", - "required": true, - "schema": { - "type": "string" - } - }, - { - "name": "start-date-time", - "in": "query", - "description": "The start of the date-time range for the data to get in the request.", - "schema": { - "type": "string", - "format": "date-time" - } - }, - { - "name": "end-date-time", - "in": "query", - "description": "The end of the date-time range for the data to get in the request.", - "schema": { - "type": "string", - "format": "date-time" - } - } + { "$ref": "#/components/parameters/location-scheme" }, + { "$ref": "#/components/parameters/location-id" }, + { "$ref": "#/components/parameters/start-date-time" }, + { "$ref": "#/components/parameters/end-date-time" } ], "responses": { "200": { "description": "Successful. The response contains the milking results for the given location", "content": { "application/json": { - "schema": { + "schema": { "type": "array", "items": { - "$ref": "icarMovementDepartureEventResource.json" + "$ref": "#/components/schemas/departure" } } } } }, "default": { - "description": "An error has occured while handling the request. Check the content of the message for the error details.", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "errors": { - "type": "array", - "items": { - "$ref": "#/components/schemas/error" - } - } - }, - "description": "A default response containing only a list of errors" - } - } - } + "$ref": "#/components/responses/default" } } } @@ -721,67 +262,30 @@ "release-candidate-registration" ], "parameters": [ - { - "name": "location-scheme", - "in": "path", - "description": "The scheme id for the location identifier.", - "required": true, - "schema": { - "type": "string", - "enum": [ - "nl.ubn", - "de.farmid", - "be.pen" - ] - } - }, - { - "name": "location-id", - "in": "path", - "description": "The unique identifier for the location.", - "required": true, - "schema": { - "type": "string" - } - } + { "$ref": "#/components/parameters/location-scheme" }, + { "$ref": "#/components/parameters/location-id" } ], "responses": { "200": { "description": "Successful. The response contains the animals for the given location", "content": { "application/json": { - "schema": { + "schema": { "type": "array", "items": { - "$ref": "icarAnimalCoreResource.json" + "$ref": "#/components/schemas/animal" } } } } }, "default": { - "description": "An error has occured while handling the request. Check the content of the message for the error details.", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "errors": { - "type": "array", - "items": { - "$ref": "#/components/schemas/error" - } - } - }, - "description": "A default response containing only a list of errors" - } - } - } + "$ref": "#/components/responses/default" } } } }, - "/locations/{location-scheme}/{location-id}/Pregnancy-Diagnosis": { + "/locations/{location-scheme}/{location-id}/pregnancy-diagnosis": { "get": { "operationId": "get-pregnancy-diagnosis", "summary": "Get the pregnancy diagnosis for a certain location", @@ -790,344 +294,169 @@ "release-candidate-reproduction" ], "parameters": [ - { - "name": "location-scheme", - "in": "path", - "description": "The scheme id for the location identifier.", - "required": true, - "schema": { - "type": "string", - "enum": [ - "nl.ubn", - "de.farmid", - "be.pen" - ] - } - }, - { - "name": "location-id", - "in": "path", - "description": "The unique identifier for the location.", - "required": true, - "schema": { - "type": "string" - } - } + { "$ref": "#/components/parameters/location-scheme" }, + { "$ref": "#/components/parameters/location-id" }, + { "$ref": "#/components/parameters/start-date-time" }, + { "$ref": "#/components/parameters/end-date-time" } ], "responses": { "200": { "description": "Successful. The response contains the pregnancy diagnosis for the given location", "content": { "application/json": { - "schema": { + "schema": { "type": "array", "items": { - "$ref": "icarReproPregnancyDiagnosisEventResource.json" + "$ref": "#/components/schemas/pregnancy-diagnosis" } } } } }, "default": { - "description": "An error has occured while handling the request. Check the content of the message for the error details.", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "errors": { - "type": "array", - "items": { - "$ref": "#/components/schemas/error" - } - } - }, - "description": "A default response containing only a list of errors" - } - } - } + "$ref": "#/components/responses/default" } } } }, - "/locations/{location-scheme}/{location-id}/Inseminations": { + "/locations/{location-scheme}/{location-id}/inseminations": { "get": { - "operationId": "get-Inseminations", + "operationId": "get-inseminations", "summary": "Get the inseminations for a certain location", "description": "# Purpose\nProvides the Inseminations on a location\n", "tags": [ "release-candidate-reproduction" ], "parameters": [ - { - "name": "location-scheme", - "in": "path", - "description": "The scheme id for the location identifier.", - "required": true, - "schema": { - "type": "string", - "enum": [ - "nl.ubn", - "de.farmid", - "be.pen" - ] - } - }, - { - "name": "location-id", - "in": "path", - "description": "The unique identifier for the location.", - "required": true, - "schema": { - "type": "string" - } - } + { "$ref": "#/components/parameters/location-scheme" }, + { "$ref": "#/components/parameters/location-id" }, + { "$ref": "#/components/parameters/start-date-time" }, + { "$ref": "#/components/parameters/end-date-time" } ], "responses": { "200": { "description": "Successful. The response contains the inseminations for the given location", "content": { "application/json": { - "schema": { + "schema": { "type": "array", "items": { - "$ref": "icarReproInseminationEventResource.json" + "$ref": "#/components/schemas/insemination" } } } } }, "default": { - "description": "An error has occured while handling the request. Check the content of the message for the error details.", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "errors": { - "type": "array", - "items": { - "$ref": "#/components/schemas/error" - } - } - }, - "description": "A default response containing only a list of errors" - } - } - } + "$ref": "#/components/responses/default" } } } }, - "/locations/{location-scheme}/{location-id}/Drying-Offs": { + "/locations/{location-scheme}/{location-id}/drying-offs": { "get": { - "operationId": "get-Drying-Offs", + "operationId": "get-drying-offs", "summary": "Get the drying off for a certain location", "description": "# Purpose\nProvides the drying off on a location\n", "tags": [ "release-candidate-reproduction" ], "parameters": [ - { - "name": "location-scheme", - "in": "path", - "description": "The scheme id for the location identifier.", - "required": true, - "schema": { - "type": "string", - "enum": [ - "nl.ubn", - "de.farmid", - "be.pen" - ] - } - }, - { - "name": "location-id", - "in": "path", - "description": "The unique identifier for the location.", - "required": true, - "schema": { - "type": "string" - } - } + { "$ref": "#/components/parameters/location-scheme" }, + { "$ref": "#/components/parameters/location-id" }, + { "$ref": "#/components/parameters/start-date-time" }, + { "$ref": "#/components/parameters/end-date-time" } ], "responses": { "200": { "description": "Successful. The response contains the drying off for the given location", "content": { "application/json": { - "schema": { + "schema": { "type": "array", "items": { - "$ref": "icarMilkingDryOffEventResource.json" + "$ref": "#/components/schemas/drying-off" } } } } }, "default": { - "description": "An error has occured while handling the request. Check the content of the message for the error details.", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "errors": { - "type": "array", - "items": { - "$ref": "#/components/schemas/error" - } - } - }, - "description": "A default response containing only a list of errors" - } - } - } + "$ref": "#/components/responses/default" } } } }, - "/locations/{location-scheme}/{location-id}/Abortions": { + "/locations/{location-scheme}/{location-id}/abortions": { "get": { - "operationId": "get-Abortions", + "operationId": "get-abortions", "summary": "Get the abortion events for a certain location", "description": "# Purpose\nProvides the abortion events on a location\n", "tags": [ "release-candidate-reproduction" ], "parameters": [ - { - "name": "location-scheme", - "in": "path", - "description": "The scheme id for the location identifier.", - "required": true, - "schema": { - "type": "string", - "enum": [ - "nl.ubn", - "de.farmid", - "be.pen" - ] - } - }, - { - "name": "location-id", - "in": "path", - "description": "The unique identifier for the location.", - "required": true, - "schema": { - "type": "string" - } - } + { "$ref": "#/components/parameters/location-scheme" }, + { "$ref": "#/components/parameters/location-id" }, + { "$ref": "#/components/parameters/start-date-time" }, + { "$ref": "#/components/parameters/end-date-time" } ], "responses": { "200": { "description": "Successful. The response contains the abortion events for the given location", "content": { "application/json": { - "schema": { + "schema": { "type": "array", "items": { - "$ref": "icarReproAbortionEventResource.json" + "$ref": "#/components/schemas/abortion" } } } } }, "default": { - "description": "An error has occured while handling the request. Check the content of the message for the error details.", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "errors": { - "type": "array", - "items": { - "$ref": "#/components/schemas/error" - } - } - }, - "description": "A default response containing only a list of errors" - } - } - } + "$ref": "#/components/responses/default" } } } }, - "/locations/{location-scheme}/{location-id}/Parturitions": { - "get": { - "operationId": "get-Parturitions", - "summary": "Get the Parturition events for a certain location", - "description": "# Purpose\nProvides the Parturition events on a location\n", - "tags": [ - "release-candidate-reproduction" - ], - "parameters": [ - { - "name": "location-scheme", - "in": "path", - "description": "The scheme id for the location identifier.", - "required": true, - "schema": { - "type": "string", - "enum": [ - "nl.ubn", - "de.farmid", - "be.pen" - ] - } - }, - { - "name": "location-id", - "in": "path", - "description": "The unique identifier for the location.", - "required": true, - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Successful. The response contains the Parturition events for the given location", - "content": { - "application/json": { - "schema": { + "/locations/{location-scheme}/{location-id}/parturitions": { + "get": { + "operationId": "get-parturitions", + "summary": "Get the parturition events for a certain location", + "description": "# Purpose\nProvides the Parturition events on a location\n", + "tags": [ + "release-candidate-reproduction" + ], + "parameters": [ + { "$ref": "#/components/parameters/location-scheme" }, + { "$ref": "#/components/parameters/location-id" }, + { "$ref": "#/components/parameters/start-date-time" }, + { "$ref": "#/components/parameters/end-date-time" } + ], + "responses": { + "200": { + "description": "Successful. The response contains the Parturition events for the given location", + "content": { + "application/json": { + "schema": { "type": "array", "items": { - "$ref": "icarReproParturitionEventResource.json" + "$ref": "#/components/schemas/parturition" } } - } - } - }, - "default": { - "description": "An error has occured while handling the request. Check the content of the message for the error details.", - "content": { - "application/json": { - "schema": { - "type": "object", - "properties": { - "errors": { - "type": "array", - "items": { - "$ref": "#/components/schemas/error" - } - } - }, - "description": "A default response containing only a list of errors" } } + }, + "default": { + "$ref": "#/components/responses/default" } } } } - } -}, -"components": { + }, + "components": { "schemas": { "error": { "type": "object", @@ -1137,6 +466,270 @@ "$ref": "exampleErrorResource.json" } } + }, + "milking-visit": { + "$ref": "icarMilkingVisitEventResource.json" + }, + "test-day-result": { + "$ref": "icarTestDayResource.json" + }, + "birth": { + "$ref": "icarMovementBirthEventResource.json" + }, + "death": { + "$ref": "icarMovementDeathEventResource.json" + }, + "arrival": { + "$ref": "icarMovementArrivalEventResource.json" + }, + "departure": { + "$ref": "icarMovementDepartureEventResource.json" + }, + "animal": { + "$ref": "icarAnimalCoreResource.json" + }, + "pregnancy-diagnosis": { + "$ref": "icarReproPregnancyDiagnosisEventResource.json" + }, + "insemination": { + "$ref": "icarReproInseminationType.json" + }, + "drying-off": { + "$ref": "icarMilkingDryOffEventResource.json" + }, + "abortion": { + "$ref": "icarReproAbortionEventResource.json" + }, + "parturition": { + "$ref": "icarReproParturitionEventResource.json" + } + }, + "parameters": { + "location-scheme": { + "name": "location-scheme", + "in": "path", + "description": "The scheme id for the location identifier.", + "required": true, + "schema": { + "type": "string", + "enum": [ + "nl.ubn", + "de.farmid", + "be.pen" + ] + } + }, + "location-id": { + "name": "location-id", + "in": "path", + "description": "The unique identifier for the location.", + "required": true, + "schema": { + "type": "string" + } + }, + "start-date-time": { + "name": "start-date-time", + "in": "query", + "description": "The start of the date-time range for the data to get in the request.", + "schema": { + "type": "string", + "format": "date-time" + } + }, + "end-date-time": { + "name": "end-date-time", + "in": "query", + "description": "The end of the date-time range for the data to get in the request.", + "schema": { + "type": "string", + "format": "date-time" + } + } + }, + "responses": { + "default": { + "description": "An error has occured while handling the request. Check the content of the message for the error details.", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "errors": { + "type": "array", + "items": { + "$ref": "#/components/schemas/error" + } + } + }, + "description": "A default response containing only a list of errors" + } + } + } + } + }, + "examples": { + "arrival": { + "value": [ + { + "id": "ac9bdd26-0e20-44e7-b311-7d3d988f9717", + "animal": { + "id": "NL 919713288", + "scheme": "nl.ubn" + }, + "eventDateTime": "2016-01-06", + "location": { + "id": "231817", + "scheme": "nl.ubn" + }, + "animalDetail": { + "alternativeIdentifiers": [], + "species": "Cattle", + "gender": "Female", + "birthDate": "2013-11-06", + "breedFractions": { + "denominator": "8", + "fractions": [ + { + "breed": { + "id": "HF", + "scheme": "icar.org" + }, + "fraction": "8" + } + ] + }, + "coatColor": "RB", + "managementTag": "88", + "name": "NELLY 258", + "productionPurpose": "Milk", + "status": "Alive", + "parentage": [ + { + "parentOf": { + "id": "NL 919713288", + "scheme": "nl.ubn" + }, + "gender": "Female", + "relation": "Genetic", + "identifier": { + "id": "NL 765410142", + "scheme": "nl.ubn" + }, + "officialName": "NELLY 211" + }, + { + "parentOf": { + "id": "NL 919713288", + "scheme": "nl.ubn" + }, + "gender": "Male", + "relation": "Genetic", + "identifier": { + "id": "NL 399745212", + "scheme": "nl.ubn" + }, + "officialName": "TOPSPEED KODAK" + } + ] + } + } + ] + }, + "milking-visit": { + "value": [ + { + "id": "706250", + "animal": { + "id": "NL 877034232", + "scheme": "nl-v1" + }, + "milkingStartingDateTime": "2019-11-01T23:58:31", + "milkingVisitDuration": { + "value": 349.0, + "unitCode": "SEC" + }, + "milkingDuration": { + "value": "210", + "unitCode": "SEC" + }, + "milkingType": "Automated", + "milkingMilkWeight": { + "value": 3.5, + "unitCode": "KGM" + }, + "milkingComplete": true, + "milkingParlourUnit": "101", + "milkingBoxNumber": 0, + "milkingDeviceId": "101", + "measureDeviceId": "101", + "eventOffset": "2019-11-01T23:58:31", + "eventDeviceId": "101", + "quarterMilkings": [ + { + "icarQuarterId": "LF", + "milkingDuration": { + "value": "210", + "unitCode": "SEC" + }, + "milkingMilkWeight": { + "value": 3.5, + "unitCode": "KGM" + } + } + ], + "animalMilkingSample": [ + { + "bottleIdentifierType": "BRC", + "rackNumber": "3", + "bottlePosition": "7" + } + ], + "icarMilkCharacteristics": [ + { + "characteristic": "FAT", + "value": "3.74", + "unit": "VP", + "icarMeasuringDevice": "to_be_defined_by_ICAR-sensor_group" + }, + { + "characteristic": "PROTEIN", + "value": "3.54", + "unit": "VP" + } + ] + } + ] + }, + "test-day-result": { + "value": [ + { + "id": "706250", + "animal": { + "id": "NL 877034232", + "scheme": "nl-v1" + }, + "EventDateTime": "2019-11-01T23:58:31", + "milkWeight24Hours": { + "value": "21.7", + "unitCode": "KGM" + }, + "testDayCode": "0", + "icarMilkCharacteristics": [ + { + "characteristic": "FAT", + "value": "3.74", + "unit": "VP", + "icarMeasuringDevice": "to_be_defined_by_ICAR-sensor_group" + }, + { + "characteristic": "PROTEIN", + "value": "3.54", + "unit": "VP" + } + ] + } + ] } } } From 5a5359cfdbdd8f90f4dbddae79ca78191797f49c Mon Sep 17 00:00:00 2001 From: Anton Hokkonen Date: Thu, 12 Dec 2019 20:05:13 +0200 Subject: [PATCH 2/3] Added missing descriptions in some resources --- Release Candidate Messages/icarAnimalCoreResource.json | 2 ++ .../icarMilkingVisitEventResource.json | 2 ++ .../icarMovementArrivalEventResource.json | 4 +++- .../icarMovementBirthEventResource.json | 2 ++ .../icarMovementDeathEventResource.json | 2 ++ .../icarMovementDepartureEventResource.json | 2 ++ Release Candidate Messages/icarTestDayResource.json | 8 +++++--- 7 files changed, 18 insertions(+), 4 deletions(-) diff --git a/Release Candidate Messages/icarAnimalCoreResource.json b/Release Candidate Messages/icarAnimalCoreResource.json index 3ff5999..4d9af85 100644 --- a/Release Candidate Messages/icarAnimalCoreResource.json +++ b/Release Candidate Messages/icarAnimalCoreResource.json @@ -6,6 +6,8 @@ ], "type": "object", + + "description": "Core schema for representing animal", "allOf": [ { diff --git a/Release Candidate Messages/icarMilkingVisitEventResource.json b/Release Candidate Messages/icarMilkingVisitEventResource.json index 8991fab..19a240d 100644 --- a/Release Candidate Messages/icarMilkingVisitEventResource.json +++ b/Release Candidate Messages/icarMilkingVisitEventResource.json @@ -7,6 +7,8 @@ ], "type": "object", + + "description": "Event for recording milking visit", "allOf": [ { diff --git a/Release Candidate Messages/icarMovementArrivalEventResource.json b/Release Candidate Messages/icarMovementArrivalEventResource.json index 435a5a7..4affefc 100644 --- a/Release Candidate Messages/icarMovementArrivalEventResource.json +++ b/Release Candidate Messages/icarMovementArrivalEventResource.json @@ -5,7 +5,9 @@ "eventDateTime", "originLocation" ], - + + "description": "Event for recording animal arrival", + "type": "object", "allOf": [ diff --git a/Release Candidate Messages/icarMovementBirthEventResource.json b/Release Candidate Messages/icarMovementBirthEventResource.json index 4f14527..99888d5 100644 --- a/Release Candidate Messages/icarMovementBirthEventResource.json +++ b/Release Candidate Messages/icarMovementBirthEventResource.json @@ -5,6 +5,8 @@ "eventDateTime", "location" ], + + "description": "Event for recording animal birth", "type": "object", diff --git a/Release Candidate Messages/icarMovementDeathEventResource.json b/Release Candidate Messages/icarMovementDeathEventResource.json index a8710e8..78de4a8 100644 --- a/Release Candidate Messages/icarMovementDeathEventResource.json +++ b/Release Candidate Messages/icarMovementDeathEventResource.json @@ -4,6 +4,8 @@ "animal", "eventDateTime" ], + + "description": "Event for recording animal death", "type": "object", diff --git a/Release Candidate Messages/icarMovementDepartureEventResource.json b/Release Candidate Messages/icarMovementDepartureEventResource.json index 8cbac98..eee4020 100644 --- a/Release Candidate Messages/icarMovementDepartureEventResource.json +++ b/Release Candidate Messages/icarMovementDepartureEventResource.json @@ -5,6 +5,8 @@ "eventDateTime", "destinationLocation" ], + + "description": "Event for recording animal departure", "type": "object", diff --git a/Release Candidate Messages/icarTestDayResource.json b/Release Candidate Messages/icarTestDayResource.json index c90d5b2..965b874 100644 --- a/Release Candidate Messages/icarTestDayResource.json +++ b/Release Candidate Messages/icarTestDayResource.json @@ -1,12 +1,14 @@ -{ +{ "required": [ "id", "animal", "EventDateTime" ], - + + "description": "Event for representing test day result", + "type": "object", - + "allOf": [ { "$ref": "icarEventCoreResource.json" From 0894f212c931e2e88dad07e869c163fdd59f15ec Mon Sep 17 00:00:00 2001 From: Anton Hokkonen Date: Fri, 13 Dec 2019 12:37:10 +0200 Subject: [PATCH 3/3] Merged changes from Erwin' commit, resolved conflicts with local changes. --- .../exampleUrlScheme.json | 48 +++++++------------ 1 file changed, 17 insertions(+), 31 deletions(-) diff --git a/Release Candidate Messages/exampleUrlScheme.json b/Release Candidate Messages/exampleUrlScheme.json index 41af9b9..17e777a 100644 --- a/Release Candidate Messages/exampleUrlScheme.json +++ b/Release Candidate Messages/exampleUrlScheme.json @@ -60,7 +60,7 @@ } }, "examples": { - "objectExample": { + "base": { "$ref": "#/components/examples/milking-visit" } } @@ -99,7 +99,7 @@ } }, "examples": { - "objectExample": { + "base": { "$ref": "#/components/examples/test-day-result" } } @@ -206,7 +206,7 @@ } }, "examples": { - "objectExample": { + "base": { "$ref": "#/components/examples/arrival" } } @@ -342,7 +342,7 @@ "schema": { "type": "array", "items": { - "$ref": "icarReproHeatEventResource.json" + "$ref": "#/components/schemas/heat" } } } @@ -476,7 +476,6 @@ "content": { "application/json": { "schema": { - ">>>>>>>" "pr/1", "type": "array", "items": { "$ref": "#/components/schemas/parturition" @@ -500,29 +499,10 @@ "release-candidate-reproduction" ], "parameters": [ - { - "name": "location-scheme", - "in": "path", - "description": "The scheme id for the location identifier.", - "required": true, - "schema": { - "type": "string", - "enum": [ - "nl.ubn", - "de.farmid", - "be.pen" - ] - } - }, - { - "name": "location-id", - "in": "path", - "description": "The unique identifier for the location.", - "required": true, - "schema": { - "type": "string" - } - } + { "$ref": "#/components/parameters/location-scheme" }, + { "$ref": "#/components/parameters/location-id" }, + { "$ref": "#/components/parameters/start-date-time" }, + { "$ref": "#/components/parameters/end-date-time" } ], "responses": { "200": { @@ -532,7 +512,7 @@ "schema": { "type": "array", "items": { - "$ref": "icarReproMatingRecommendationResource.json" + "$ref": "#/components/schemas/mating-recommendation" } } } @@ -559,6 +539,9 @@ "milking-visit": { "$ref": "icarMilkingVisitEventResource.json" }, + "mating-recommendation": { + "$ref": "icarReproMatingRecommendationResource.json" + }, "test-day-result": { "$ref": "icarTestDayResource.json" }, @@ -577,11 +560,14 @@ "animal": { "$ref": "icarAnimalCoreResource.json" }, - "pregnancy-checks": { + "pregnancy-check": { "$ref": "icarReproPregnancyCheckEventResource.json" }, + "heat": { + "$ref": "icarReproHeatEventResource.json" + }, "insemination": { - "$ref": "icarReproInseminationType.json" + "$ref": "icarReproInseminationEventResource.json" }, "drying-off": { "$ref": "icarMilkingDryOffEventResource.json"