diff --git a/repo/rest-api/specs/global/examples.json b/repo/rest-api/specs/global/examples.json index 76d32e54fb5..584f019c888 100644 --- a/repo/rest-api/specs/global/examples.json +++ b/repo/rest-api/specs/global/examples.json @@ -436,6 +436,17 @@ } } }, + "PropertyLabelDuplicateExample": { + "value": { + "code": "property-label-duplicate", + "message": "Property '{duplicate_property_id}' already has label '{label}' associated with language code {language}", + "context": { + "language": "{language}", + "label": "{label}", + "matching-property-id": "{duplicate_property_id}" + } + } + }, "ItemStatementIdExample": { "value": "Q42$F078E5B3-F9A8-480E-B7AC-D97778CBBEF9" }, diff --git a/repo/rest-api/specs/global/requests.json b/repo/rest-api/specs/global/requests.json index f550637726f..b4c8bffb888 100644 --- a/repo/rest-api/specs/global/requests.json +++ b/repo/rest-api/specs/global/requests.json @@ -11,7 +11,7 @@ "properties": { "label": { "type": "string", - "example": "Douglas Adams" + "example": "an example label" } }, "required": [ "label" ] diff --git a/repo/rest-api/specs/global/responses.json b/repo/rest-api/specs/global/responses.json index 90681594035..9840cc584f5 100644 --- a/repo/rest-api/specs/global/responses.json +++ b/repo/rest-api/specs/global/responses.json @@ -659,6 +659,35 @@ } } }, + "InvalidSetPropertyLabelInput": { + "description": "The request cannot be processed", + "content": { + "application/json": { + "schema": { "$ref": "./response-parts.json#/ContextError" }, + "examples": { + "invalid-property-id": { "$ref": "./examples.json#/InvalidPropertyIdExample" }, + "invalid-language-code": { "$ref": "./examples.json#/InvalidLanguageCodeExample" }, + "invalid-label": { "$ref": "./examples.json#/InvalidLabelExample" }, + "label-empty": { "$ref": "./examples.json#/LabelEmptyExample" }, + "label-too-long": { "$ref": "./examples.json#/LabelTooLongExample" }, + "label-description-same-value": { + "$ref": "./examples.json#/LabelDescriptionSameValueExample" + }, + "property-label-duplicate": { + "$ref": "./examples.json#/PropertyLabelDuplicateExample" + }, + "invalid-edit-tag": { "$ref": "./examples.json#/InvalidEditTagExample" }, + "comment-too-long": { "$ref": "./examples.json#/CommentTooLongExample" } + } + } + }, + "headers": { + "Content-Language": { + "schema": { "type": "string" }, + "description": "Language code of the language in which error message is provided" + } + } + }, "InvalidSetItemDescriptionInput": { "description": "The request cannot be processed", "content": { @@ -1136,37 +1165,6 @@ } } }, - "ItemLabel": { - "description": "Item's label in a specific language", - "headers": { - "Last-Modified": { - "schema": { - "type": "string" - }, - "description": "Last modified date" - }, - "ETag": { - "schema": { - "type": "string" - }, - "description": "Last entity revision number" - }, - "X-Authenticated-User": { - "schema": { - "type": "string" - }, - "description": "Optional username of the user making the request" - } - }, - "content": { - "application/json": { - "schema": { - "type": "string", - "example": "Douglas Adams" - } - } - } - }, "ItemDescriptions": { "description": "Item's descriptions by language", "headers": { @@ -1322,8 +1320,8 @@ } } }, - "PropertyLabel": { - "description": "Property's label in a specific language", + "Label": { + "description": "A label in a specific language", "headers": { "Last-Modified": { "schema": { @@ -1348,7 +1346,7 @@ "application/json": { "schema": { "type": "string", - "example": "instance of" + "example": "an example label" } } } diff --git a/repo/rest-api/specs/resources/labels/label-in-language-for-item.json b/repo/rest-api/specs/resources/labels/label-in-language-for-item.json index 8042245c747..e6ed879f49e 100644 --- a/repo/rest-api/specs/resources/labels/label-in-language-for-item.json +++ b/repo/rest-api/specs/resources/labels/label-in-language-for-item.json @@ -13,7 +13,7 @@ { "$ref": "../../global/parameters.json#/Authorization" } ], "responses": { - "200": { "$ref": "../../global/responses.json#/ItemLabel" }, + "200": { "$ref": "../../global/responses.json#/Label" }, "304": { "$ref": "../../global/responses.json#/NotModified" }, "308": { "$ref": "../../global/responses.json#/Moved" }, "400": { "$ref": "../../global/responses.json#/InvalidItemTermByLanguageInput" }, @@ -38,11 +38,11 @@ "requestBody": { "$ref": "../../global/requests.json#/Label" }, "responses": { "200": { - "$ref": "../../global/responses.json#/ItemLabel", + "$ref": "../../global/responses.json#/Label", "description": "The updated Label in a specific language" }, "201": { - "$ref": "../../global/responses.json#/ItemLabel", + "$ref": "../../global/responses.json#/Label", "description": "The newly added Label in a specific language" }, "304": { "$ref": "../../global/responses.json#/NotModified" }, diff --git a/repo/rest-api/specs/resources/labels/label-in-language-for-property.json b/repo/rest-api/specs/resources/labels/label-in-language-for-property.json index ec6d4d7248b..49e43678bd2 100644 --- a/repo/rest-api/specs/resources/labels/label-in-language-for-property.json +++ b/repo/rest-api/specs/resources/labels/label-in-language-for-property.json @@ -13,12 +13,45 @@ { "$ref": "../../global/parameters.json#/Authorization" } ], "responses": { - "200": { "$ref": "../../global/responses.json#/PropertyLabel" }, + "200": { "$ref": "../../global/responses.json#/Label" }, "304": { "$ref": "../../global/responses.json#/NotModified" }, "400": { "$ref": "../../global/responses.json#/InvalidPropertyTermByLanguageInput" }, "404": { "$ref": "../../global/responses.json#/PropertyLabelNotFound" }, "412": { "$ref": "../../global/responses.json#/PreconditionFailedError" }, "500": { "$ref": "../../global/responses.json#/UnexpectedError" } } + }, + "put": { + "operationId": "replacePropertyLabel", + "tags": [ "labels" ], + "summary": "[WIP] Add / Replace a Property's label in a specific language", + "description": "This endpoint is currently in development and is not recommended for production use.", + "parameters": [ + { "$ref": "../../global/parameters.json#/PropertyId" }, + { "$ref": "../../global/parameters.json#/LanguageCode" }, + { "$ref": "../../global/parameters.json#/IfNoneMatch" }, + { "$ref": "../../global/parameters.json#/IfModifiedSince" }, + { "$ref": "../../global/parameters.json#/IfMatch" }, + { "$ref": "../../global/parameters.json#/IfUnmodifiedSince" }, + { "$ref": "../../global/parameters.json#/Authorization" } + ], + "requestBody": { "$ref": "../../global/requests.json#/Label" }, + "responses": { + "200": { + "$ref": "../../global/responses.json#/Label", + "description": "The updated Label in a specific language" + }, + "201": { + "$ref": "../../global/responses.json#/Label", + "description": "The newly added Label in a specific language" + }, + "304": { "$ref": "../../global/responses.json#/NotModified" }, + "400": { "$ref": "../../global/responses.json#/InvalidSetPropertyLabelInput" }, + "404": { "$ref": "../../global/responses.json#/PropertyNotFound" }, + "412": { "$ref": "../../global/responses.json#/PreconditionFailedError" }, + "415": { "$ref": "../../global/responses.json#/InvalidMediaType" }, + "500": { "$ref": "../../global/responses.json#/UnexpectedError" } + } } + }