Skip to content

Commit

Permalink
Merge "REST: Move out responses that are specific to one endpoint only."
Browse files Browse the repository at this point in the history
  • Loading branch information
jenkins-bot authored and Gerrit Code Review committed Sep 16, 2024
2 parents bc3be82 + dfe7382 commit 69ae731
Show file tree
Hide file tree
Showing 16 changed files with 1,455 additions and 1,521 deletions.
601 changes: 0 additions & 601 deletions repo/rest-api/specs/global/responses.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion repo/rest-api/specs/resources/items/list.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"requestBody": { "$ref": "../../global/requests.json#/Item" },
"responses": {
"201": { "$ref": "../../global/responses.json#/Item" },
"400": { "$ref": "../../global/responses.json#/InvalidNewItemInput" },
"400": { "$ref": "./responses.json#/InvalidNewItemInput" },
"422": { "$ref": "../../global/responses.json#/DataPolicyViolation" },
"500": { "$ref": "../../global/responses.json#/UnexpectedError" }
}
Expand Down
43 changes: 43 additions & 0 deletions repo/rest-api/specs/resources/items/responses.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"InvalidNewItemInput": {
"description": "The request cannot be processed",
"content": {
"application/json": {
"schema": { "$ref": "../../global/response-parts.json#/Error" },
"examples": {
"value-too-long": { "$ref": "../../global/examples.json#/ValueTooLongExample" },
"statement-group-property-id-mismatch": { "$ref": "../../global/examples.json#/StatementGroupPropertyIdMismatch" },
"referenced-resource-not-found": { "$ref": "../../global/examples.json#/ReferencedResourceNotFoundExample" },
"invalid-value": { "$ref": "../../global/examples.json#/InvalidValueExample" },
"missing-field": { "$ref": "../../global/examples.json#/MissingFieldExample" },
"invalid-key": { "$ref": "../../global/examples.json#/InvalidKeyExample" },
"resource-too-large": { "$ref": "../../global/examples.json#/ResourceTooLargeExample" }
}
}
},
"headers": {
"Content-Language": {
"schema": { "type": "string" },
"description": "Language code of the language in which error message is provided"
}
}
},
"InvalidGetItemInput": {
"description": "The request cannot be processed",
"content": {
"application/json": {
"schema": { "$ref": "../../global/response-parts.json#/Error" },
"examples": {
"invalid-path-parameter": { "$ref": "../../global/examples.json#/InvalidPathParameterExample" },
"invalid-query-parameter": { "$ref": "../../global/examples.json#/InvalidQueryParameterExample" }
}
}
},
"headers": {
"Content-Language": {
"schema": { "type": "string" },
"description": "Language code of the language in which error message is provided"
}
}
}
}
2 changes: 1 addition & 1 deletion repo/rest-api/specs/resources/items/single.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"200": { "$ref": "../../global/responses.json#/Item" },
"308": { "$ref": "../../global/responses.json#/Moved" },
"304": { "$ref": "../../global/responses.json#/NotModified" },
"400": { "$ref": "../../global/responses.json#/InvalidGetItemInput" },
"400": { "$ref": "./responses.json#/InvalidGetItemInput" },
"404": { "$ref": "../../global/responses.json#/ResourceNotFound" },
"412": { "$ref": "../../global/responses.json#/PreconditionFailedError" },
"500": { "$ref": "../../global/responses.json#/UnexpectedError" }
Expand Down
20 changes: 20 additions & 0 deletions repo/rest-api/specs/resources/properties/responses.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"InvalidPropertyInput": {
"description": "The request cannot be processed",
"content": {
"application/json": {
"schema": { "$ref": "../../global/response-parts.json#/Error" },
"examples": {
"invalid-path-parameter": { "$ref": "../../global/examples.json#/InvalidPathParameterExample" },
"invalid-query-parameter": { "$ref": "../../global/examples.json#/InvalidQueryParameterExample" }
}
}
},
"headers": {
"Content-Language": {
"schema": { "type": "string" },
"description": "Language code of the language in which error message is provided"
}
}
}
}
2 changes: 1 addition & 1 deletion repo/rest-api/specs/resources/properties/single.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
],
"responses": {
"200": { "$ref": "../../global/responses.json#/Property" },
"400": { "$ref": "../../global/responses.json#/InvalidPropertyInput" },
"400": { "$ref": "./responses.json#/InvalidPropertyInput" },
"404": { "$ref": "../../global/responses.json#/ResourceNotFound" },
"500": { "$ref": "../../global/responses.json#/UnexpectedError" }
}
Expand Down
2 changes: 1 addition & 1 deletion repo/rest-api/specs/resources/sitelinks/list.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"404": { "$ref": "../../global/responses.json#/ResourceNotFound" },
"409": { "$ref": "../../global/responses.json#/CannotApplyItemPatch" },
"412": { "$ref": "../../global/responses.json#/PreconditionFailedError" },
"422": { "$ref": "../../global/responses.json#/InvalidPatchedItemSitelinks" },
"422": { "$ref": "./responses.json#/InvalidPatchedItemSitelinks" },
"500": { "$ref": "../../global/responses.json#/UnexpectedError" }
}
}
Expand Down
101 changes: 101 additions & 0 deletions repo/rest-api/specs/resources/sitelinks/responses.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{
"InvalidPatchedItemSitelinks": {
"description": "Applying the provided JSON Patch results in invalid sitelinks",
"content": {
"application/json": {
"schema": { "$ref": "../../global/response-parts.json#/Error" },
"examples": {
"patch-result-referenced-resource-not-found": { "$ref": "../../global/examples.json#/PatchResultResourceNotFoundExample" },
"patch-result-invalid-value": { "$ref": "../../global/examples.json#/PatchResultInvalidValueExample" },
"patch-result-missing-field": { "$ref": "../../global/examples.json#/PatchResultMissingFieldExample" },
"patch-result-invalid-key": { "$ref": "../../global/examples.json#/PatchResultInvalidKeyExample" },
"url-not-modifiable": { "$ref": "../../global/examples.json#/SitelinkUrlNotModifiableExample" },
"data-policy-violation": { "$ref": "../../global/examples.json#/DataPolicyViolationExample" }
}
}
},
"headers": {
"Content-Language": {
"schema": { "type": "string" },
"description": "Language code of the language in which error message is provided"
}
}
},
"SitelinkDeleted": {
"description": "The resource was deleted",
"headers": {
"Content-Language": {
"description": "Language code of the language in which response is provided",
"schema": {
"type": "string"
}
}
},
"content": {
"application/json": {
"schema": {
"type": "string"
},
"example": "Sitelink deleted"
}
}
},
"InvalidRemoveSitelinkInput": {
"description": "The request cannot be processed",
"content": {
"application/json": {
"schema": { "$ref": "../../global/response-parts.json#/Error" },
"examples": {
"invalid-path-parameter": { "$ref": "../../global/examples.json#/InvalidPathParameterExample" },
"invalid-value": { "$ref": "../../global/examples.json#/InvalidValueExample" },
"value-too-long": { "$ref": "../../global/examples.json#/ValueTooLongExample" }
}
}
},
"headers": {
"Content-Language": {
"schema": { "type": "string" },
"description": "Language code of the language in which error message is provided"
}
}
},
"InvalidSetSitelinkInput": {
"description": "The request cannot be processed",
"content": {
"application/json": {
"schema": { "$ref": "../../global/response-parts.json#/Error" },
"examples": {
"invalid-path-parameter": { "$ref": "../../global/examples.json#/InvalidPathParameterExample" },
"invalid-value": { "$ref": "../../global/examples.json#/InvalidValueExample" },
"missing-field": { "$ref": "../../global/examples.json#/MissingFieldExample" },
"value-too-long": { "$ref": "../../global/examples.json#/ValueTooLongExample" },
"referenced-resource-not-found": { "$ref": "../../global/examples.json#/ReferencedResourceNotFoundExample" },
"resource-too-large": { "$ref": "../../global/examples.json#/ResourceTooLargeExample" }
}
}
},
"headers": {
"Content-Language": {
"schema": { "type": "string" },
"description": "Language code of the language in which error message is provided"
}
}
},
"InvalidGetSitelinkInput": {
"description": "The request cannot be processed",
"content": {
"application/json": {
"schema": { "$ref": "../../global/response-parts.json#/Error" },
"examples": {
"invalid-path-parameter": { "$ref": "../../global/examples.json#/InvalidPathParameterExample" }
}
}
},
"headers": {
"Content-Language": {
"schema": { "type": "string" },
"description": "Language code of the language in which error message is provided"
}
}
}
}
10 changes: 5 additions & 5 deletions repo/rest-api/specs/resources/sitelinks/single.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"200": { "$ref": "../../global/responses.json#/Sitelink" },
"304": { "$ref": "../../global/responses.json#/NotModified" },
"308": { "$ref": "../../global/responses.json#/Moved" },
"400": { "$ref": "../../global/responses.json#/InvalidGetSitelinkInput" },
"400": { "$ref": "./responses.json#/InvalidGetSitelinkInput" },
"404": { "$ref": "../../global/responses.json#/ResourceNotFound" },
"412": { "$ref": "../../global/responses.json#/PreconditionFailedError" },
"500": { "$ref": "../../global/responses.json#/UnexpectedError" }
Expand Down Expand Up @@ -45,11 +45,11 @@
"$ref": "../../global/responses.json#/Sitelink",
"description": "The newly added Sitelink"
},
"400": { "$ref": "../../global/responses.json#/InvalidSetSitelinkInput" },
"400": { "$ref": "./responses.json#/InvalidSetSitelinkInput" },
"404": { "$ref": "../../global/responses.json#/ResourceNotFound" },
"409": { "$ref": "../../global/responses.json#/ItemRedirected" },
"412": { "$ref": "../../global/responses.json#/PreconditionFailedError" },
"422": { "$ref": "../../global/responses.json#/DataPolicyViolation"},
"422": { "$ref": "../../global/responses.json#/DataPolicyViolation" },
"500": { "$ref": "../../global/responses.json#/UnexpectedError" }
}
},
Expand All @@ -68,8 +68,8 @@
],
"requestBody": { "$ref": "../../global/requests.json#/Edit" },
"responses": {
"200": { "$ref": "../../global/responses.json#/SitelinkDeleted" },
"400": { "$ref": "../../global/responses.json#/InvalidRemoveSitelinkInput" },
"200": { "$ref": "./responses.json#/SitelinkDeleted" },
"400": { "$ref": "./responses.json#/InvalidRemoveSitelinkInput" },
"404": { "$ref": "../../global/responses.json#/ResourceNotFound" },
"409": { "$ref": "../../global/responses.json#/ItemRedirected" },
"412": { "$ref": "../../global/responses.json#/PreconditionFailedError" },
Expand Down
4 changes: 2 additions & 2 deletions repo/rest-api/specs/resources/statements/list-for-item.json
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#/ItemStatements" },
"200": { "$ref": "./responses.json#/ItemStatements" },
"304": { "$ref": "../../global/responses.json#/NotModified" },
"308": { "$ref": "../../global/responses.json#/Moved" },
"400": { "$ref": "../../global/responses.json#/InvalidRetrieveStatementsInput" },
Expand All @@ -34,7 +34,7 @@
],
"requestBody": { "$ref": "../../global/requests.json#/Statement" },
"responses": {
"201": { "$ref": "../../global/responses.json#/ItemStatementCreated" },
"201": { "$ref": "./responses.json#/ItemStatementCreated" },
"400": { "$ref": "../../global/responses.json#/InvalidNewStatementInput" },
"404": { "$ref": "../../global/responses.json#/ResourceNotFound" },
"409": { "$ref": "../../global/responses.json#/ItemRedirected" },
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#/PropertyStatements" },
"200": { "$ref": "./responses.json#/PropertyStatements" },
"304": { "$ref": "../../global/responses.json#/NotModified" },
"400": { "$ref": "../../global/responses.json#/InvalidRetrieveStatementsInput" },
"404": { "$ref": "../../global/responses.json#/ResourceNotFound" },
Expand All @@ -33,7 +33,7 @@
],
"requestBody": { "$ref": "../../global/requests.json#/Statement" },
"responses": {
"201": { "$ref": "../../global/responses.json#/PropertyStatementCreated" },
"201": { "$ref": "./responses.json#/PropertyStatementCreated" },
"400": { "$ref": "../../global/responses.json#/InvalidNewStatementInput" },
"404": { "$ref": "../../global/responses.json#/ResourceNotFound" },
"412": { "$ref": "../../global/responses.json#/PreconditionFailedError" },
Expand Down
Loading

0 comments on commit 69ae731

Please sign in to comment.