mirror of
https://github.com/shlinkio/shlink.git
synced 2025-02-16 23:39:54 +03:00
Added extra examples for error responses in swagger docs
This commit is contained in:
parent
808ae6a442
commit
0fd941401b
17 changed files with 211 additions and 30 deletions
9
docs/swagger/examples/short-url-invalid-args.json
Normal file
9
docs/swagger/examples/short-url-invalid-args.json
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"value": {
|
||||
"title": "Invalid data",
|
||||
"type": "INVALID_ARGUMENT",
|
||||
"detail": "Provided data is not valid",
|
||||
"status": 400,
|
||||
"invalidElements": ["maxVisits", "validSince"]
|
||||
}
|
||||
}
|
9
docs/swagger/examples/short-url-not-found.json
Normal file
9
docs/swagger/examples/short-url-not-found.json
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"value": {
|
||||
"detail":"No URL found with short code \"abc123\"",
|
||||
"title":"Short URL not found",
|
||||
"type": "INVALID_SHORTCODE",
|
||||
"status": 404,
|
||||
"shortCode": "abc123"
|
||||
}
|
||||
}
|
9
docs/swagger/examples/tag-not-found.json
Normal file
9
docs/swagger/examples/tag-not-found.json
Normal file
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"value": {
|
||||
"detail": "Tag with name \"foo\" could not be found",
|
||||
"title": "Tag not found",
|
||||
"type": "TAG_NOT_FOUND",
|
||||
"status": 404,
|
||||
"tag": "foo"
|
||||
}
|
||||
}
|
|
@ -43,7 +43,7 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"default": {
|
||||
"description": "Unexpected error.",
|
||||
"content": {
|
||||
"application/json": {
|
||||
|
|
|
@ -187,7 +187,7 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"default": {
|
||||
"description": "Unexpected error.",
|
||||
"content": {
|
||||
"application/problem+json": {
|
||||
|
@ -322,22 +322,42 @@
|
|||
"customSlug": {
|
||||
"type": "string",
|
||||
"description": "Provided custom slug when the error type is INVALID_SLUG"
|
||||
},
|
||||
"domain": {"type": "string",
|
||||
"description": "The domain for which you were trying to create the new short URL"
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"example": {
|
||||
"title": "Invalid URL",
|
||||
"type": "INVALID_URL",
|
||||
"detail": "Provided URL foo is invalid. Try with a different one.",
|
||||
"status": 400,
|
||||
"url": "https://invalid-url.com"
|
||||
"examples": {
|
||||
"Invalid arguments": {
|
||||
"$ref": "../examples/short-url-invalid-args.json"
|
||||
},
|
||||
"Invalid long URL": {
|
||||
"value": {
|
||||
"title": "Invalid URL",
|
||||
"type": "INVALID_URL",
|
||||
"detail": "Provided URL foo is invalid. Try with a different one.",
|
||||
"status": 400,
|
||||
"url": "https://invalid-url.com"
|
||||
}
|
||||
},
|
||||
"Non-unique slug": {
|
||||
"value": {
|
||||
"title": "Invalid custom slug",
|
||||
"type": "INVALID_SLUG",
|
||||
"detail": "Provided slug \"my-slug\" is already in use.",
|
||||
"status": 400,
|
||||
"customSlug": "my-slug"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"default": {
|
||||
"description": "Unexpected error.",
|
||||
"content": {
|
||||
"application/problem+json": {
|
||||
|
|
|
@ -101,7 +101,7 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"default": {
|
||||
"description": "Unexpected error.",
|
||||
"content": {
|
||||
"application/problem+json": {
|
||||
|
|
|
@ -62,12 +62,35 @@
|
|||
"content": {
|
||||
"application/problem+json": {
|
||||
"schema": {
|
||||
"$ref": "../definitions/Error.json"
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../definitions/Error.json"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": ["shortCode"],
|
||||
"properties": {
|
||||
"shortCode": {
|
||||
"type": "string",
|
||||
"description": "The short code with which we tried to find the short URL"
|
||||
},
|
||||
"domain": {
|
||||
"type": "string",
|
||||
"description": "The domain with which we tried to find the short URL"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"examples": {
|
||||
"Not found": {
|
||||
"$ref": "../examples/short-url-not-found.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"default": {
|
||||
"description": "Unexpected error.",
|
||||
"content": {
|
||||
"application/problem+json": {
|
||||
|
@ -178,21 +201,49 @@
|
|||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"examples": {
|
||||
"Invalid arguments": {
|
||||
"$ref": "../examples/short-url-invalid-args.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "No short URL was found for provided short code.",
|
||||
"description": "No URL was found for provided short code.",
|
||||
"content": {
|
||||
"application/problem+json": {
|
||||
"schema": {
|
||||
"$ref": "../definitions/Error.json"
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../definitions/Error.json"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": ["shortCode"],
|
||||
"properties": {
|
||||
"shortCode": {
|
||||
"type": "string",
|
||||
"description": "The short code with which we tried to find the short URL"
|
||||
},
|
||||
"domain": {
|
||||
"type": "string",
|
||||
"description": "The domain with which we tried to find the short URL"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"examples": {
|
||||
"Not found": {
|
||||
"$ref": "../examples/short-url-not-found.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"default": {
|
||||
"description": "Unexpected error.",
|
||||
"content": {
|
||||
"application/problem+json": {
|
||||
|
@ -279,16 +330,39 @@
|
|||
}
|
||||
},
|
||||
"404": {
|
||||
"description": "No short URL was found for provided short code.",
|
||||
"description": "No URL was found for provided short code.",
|
||||
"content": {
|
||||
"application/problem+json": {
|
||||
"schema": {
|
||||
"$ref": "../definitions/Error.json"
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "../definitions/Error.json"
|
||||
},
|
||||
{
|
||||
"type": "object",
|
||||
"required": ["shortCode"],
|
||||
"properties": {
|
||||
"shortCode": {
|
||||
"type": "string",
|
||||
"description": "The short code with which we tried to find the short URL"
|
||||
},
|
||||
"domain": {
|
||||
"type": "string",
|
||||
"description": "The domain with which we tried to find the short URL"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"examples": {
|
||||
"Not found": {
|
||||
"$ref": "../examples/short-url-not-found.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"default": {
|
||||
"description": "Unexpected error.",
|
||||
"content": {
|
||||
"application/problem+json": {
|
||||
|
|
|
@ -91,7 +91,7 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"default": {
|
||||
"description": "Unexpected error.",
|
||||
"content": {
|
||||
"application/json": {
|
||||
|
|
|
@ -149,11 +149,16 @@
|
|||
"application/problem+json": {
|
||||
"schema": {
|
||||
"$ref": "../definitions/Error.json"
|
||||
},
|
||||
"examples": {
|
||||
"Short URL not found": {
|
||||
"$ref": "../examples/short-url-not-found.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"default": {
|
||||
"description": "Unexpected error.",
|
||||
"content": {
|
||||
"application/problem+json": {
|
||||
|
|
|
@ -97,7 +97,7 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"default": {
|
||||
"description": "Unexpected error.",
|
||||
"content": {
|
||||
"application/problem+json": {
|
||||
|
@ -175,7 +175,7 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"default": {
|
||||
"description": "Unexpected error.",
|
||||
"content": {
|
||||
"application/problem+json": {
|
||||
|
@ -240,6 +240,13 @@
|
|||
"application/problem+json": {
|
||||
"schema": {
|
||||
"$ref": "../definitions/Error.json"
|
||||
},
|
||||
"example": {
|
||||
"title": "Invalid data",
|
||||
"type": "INVALID_ARGUMENT",
|
||||
"detail": "Provided data is not valid",
|
||||
"status": 400,
|
||||
"invalidElements": ["oldName", "newName"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -250,6 +257,12 @@
|
|||
"application/problem+json": {
|
||||
"schema": {
|
||||
"$ref": "../definitions/Error.json"
|
||||
},
|
||||
"example": {
|
||||
"detail": "You are not allowed to rename tags",
|
||||
"title": "Forbidden tag operation",
|
||||
"type": "FORBIDDEN_OPERATION",
|
||||
"status": 403
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -260,6 +273,11 @@
|
|||
"application/problem+json": {
|
||||
"schema": {
|
||||
"$ref": "../definitions/Error.json"
|
||||
},
|
||||
"examples": {
|
||||
"Tag not found": {
|
||||
"$ref": "../examples/tag-not-found.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -270,11 +288,19 @@
|
|||
"application/problem+json": {
|
||||
"schema": {
|
||||
"$ref": "../definitions/Error.json"
|
||||
},
|
||||
"example": {
|
||||
"detail": "You cannot rename tag foo, because it already exists",
|
||||
"title": "Tag conflict",
|
||||
"type": "TAG_CONFLICT",
|
||||
"status": 409,
|
||||
"oldName": "bar",
|
||||
"newName": "foo"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"default": {
|
||||
"description": "Unexpected error.",
|
||||
"content": {
|
||||
"application/problem+json": {
|
||||
|
@ -326,11 +352,17 @@
|
|||
"application/problem+json": {
|
||||
"schema": {
|
||||
"$ref": "../definitions/Error.json"
|
||||
},
|
||||
"example": {
|
||||
"detail": "You are not allowed to delete tags",
|
||||
"title": "Forbidden tag operation",
|
||||
"type": "FORBIDDEN_OPERATION",
|
||||
"status": 403
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"default": {
|
||||
"description": "Unexpected error.",
|
||||
"content": {
|
||||
"application/problem+json": {
|
||||
|
|
|
@ -95,7 +95,7 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"default": {
|
||||
"description": "Unexpected error.",
|
||||
"content": {
|
||||
"application/problem+json": {
|
||||
|
|
|
@ -93,11 +93,18 @@
|
|||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"example": {
|
||||
"title": "Invalid data",
|
||||
"type": "INVALID_ARGUMENT",
|
||||
"detail": "Provided data is not valid",
|
||||
"status": 400,
|
||||
"invalidElements": ["domain", "invalidShortUrlRedirect"]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"default": {
|
||||
"description": "Unexpected error.",
|
||||
"content": {
|
||||
"application/problem+json": {
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"default": {
|
||||
"description": "Unexpected error.",
|
||||
"content": {
|
||||
"application/problem+json": {
|
||||
|
|
|
@ -146,11 +146,16 @@
|
|||
"application/problem+json": {
|
||||
"schema": {
|
||||
"$ref": "../definitions/Error.json"
|
||||
},
|
||||
"examples": {
|
||||
"Tag not found": {
|
||||
"$ref": "../examples/tag-not-found.json"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"default": {
|
||||
"description": "Unexpected error.",
|
||||
"content": {
|
||||
"application/problem+json": {
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"default": {
|
||||
"description": "Unexpected error.",
|
||||
"content": {
|
||||
"application/problem+json": {
|
||||
|
|
|
@ -137,7 +137,7 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"500": {
|
||||
"default": {
|
||||
"description": "Unexpected error.",
|
||||
"content": {
|
||||
"application/problem+json": {
|
||||
|
|
|
@ -60,6 +60,17 @@
|
|||
"enum": ["L", "M", "Q", "H"],
|
||||
"default": "L"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "roundBlockSize",
|
||||
"in": "query",
|
||||
"description": "Allows to disable block size rounding, which might reduce the readability of the QR code, but ensures no extra margin is added.",
|
||||
"required": false,
|
||||
"schema": {
|
||||
"type": "string",
|
||||
"enum": ["true", "false"],
|
||||
"default": "false"
|
||||
}
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
|
|
Loading…
Add table
Reference in a new issue