Skip to content

Commit

Permalink
Merge "REST: Add PUT property label route to OAS"
Browse files Browse the repository at this point in the history
  • Loading branch information
jenkins-bot authored and Gerrit Code Review committed Oct 11, 2023
2 parents 8f9c6eb + 7f41bb8 commit 1857f64
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 39 deletions.
11 changes: 11 additions & 0 deletions repo/rest-api/specs/global/examples.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
2 changes: 1 addition & 1 deletion repo/rest-api/specs/global/requests.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"properties": {
"label": {
"type": "string",
"example": "Douglas Adams"
"example": "an example label"
}
},
"required": [ "label" ]
Expand Down
66 changes: 32 additions & 34 deletions repo/rest-api/specs/global/responses.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -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": {
Expand All @@ -1348,7 +1346,7 @@
"application/json": {
"schema": {
"type": "string",
"example": "instance of"
"example": "an example label"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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" },
Expand All @@ -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" },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
}
}

}

0 comments on commit 1857f64

Please sign in to comment.