diff --git a/docs/swagger/examples/short-url-invalid-args.json b/docs/swagger/examples/short-url-invalid-args.json new file mode 100644 index 00000000..d85a5eed --- /dev/null +++ b/docs/swagger/examples/short-url-invalid-args.json @@ -0,0 +1,9 @@ +{ + "value": { + "title": "Invalid data", + "type": "INVALID_ARGUMENT", + "detail": "Provided data is not valid", + "status": 400, + "invalidElements": ["maxVisits", "validSince"] + } +} diff --git a/docs/swagger/examples/short-url-not-found.json b/docs/swagger/examples/short-url-not-found.json new file mode 100644 index 00000000..74a5661c --- /dev/null +++ b/docs/swagger/examples/short-url-not-found.json @@ -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" + } +} diff --git a/docs/swagger/examples/tag-not-found.json b/docs/swagger/examples/tag-not-found.json new file mode 100644 index 00000000..46018121 --- /dev/null +++ b/docs/swagger/examples/tag-not-found.json @@ -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" + } +} diff --git a/docs/swagger/paths/health.json b/docs/swagger/paths/health.json index c9cb300f..8dc5e7da 100644 --- a/docs/swagger/paths/health.json +++ b/docs/swagger/paths/health.json @@ -43,7 +43,7 @@ } } }, - "500": { + "default": { "description": "Unexpected error.", "content": { "application/json": { diff --git a/docs/swagger/paths/v1_short-urls.json b/docs/swagger/paths/v1_short-urls.json index ecef0285..4ef28bd2 100644 --- a/docs/swagger/paths/v1_short-urls.json +++ b/docs/swagger/paths/v1_short-urls.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": { diff --git a/docs/swagger/paths/v1_short-urls_shorten.json b/docs/swagger/paths/v1_short-urls_shorten.json index e1d98129..722476bb 100644 --- a/docs/swagger/paths/v1_short-urls_shorten.json +++ b/docs/swagger/paths/v1_short-urls_shorten.json @@ -101,7 +101,7 @@ } } }, - "500": { + "default": { "description": "Unexpected error.", "content": { "application/problem+json": { diff --git a/docs/swagger/paths/v1_short-urls_{shortCode}.json b/docs/swagger/paths/v1_short-urls_{shortCode}.json index 6fac0745..eec1cec3 100644 --- a/docs/swagger/paths/v1_short-urls_{shortCode}.json +++ b/docs/swagger/paths/v1_short-urls_{shortCode}.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": { diff --git a/docs/swagger/paths/v1_short-urls_{shortCode}_tags.json b/docs/swagger/paths/v1_short-urls_{shortCode}_tags.json index 3cad48ad..645c6ef2 100644 --- a/docs/swagger/paths/v1_short-urls_{shortCode}_tags.json +++ b/docs/swagger/paths/v1_short-urls_{shortCode}_tags.json @@ -91,7 +91,7 @@ } } }, - "500": { + "default": { "description": "Unexpected error.", "content": { "application/json": { diff --git a/docs/swagger/paths/v1_short-urls_{shortCode}_visits.json b/docs/swagger/paths/v1_short-urls_{shortCode}_visits.json index 9fbe5433..08a93b68 100644 --- a/docs/swagger/paths/v1_short-urls_{shortCode}_visits.json +++ b/docs/swagger/paths/v1_short-urls_{shortCode}_visits.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": { diff --git a/docs/swagger/paths/v1_tags.json b/docs/swagger/paths/v1_tags.json index d33d2b51..12cdef81 100644 --- a/docs/swagger/paths/v1_tags.json +++ b/docs/swagger/paths/v1_tags.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": { diff --git a/docs/swagger/paths/v2_domains.json b/docs/swagger/paths/v2_domains.json index da41ac3f..7568c64a 100644 --- a/docs/swagger/paths/v2_domains.json +++ b/docs/swagger/paths/v2_domains.json @@ -95,7 +95,7 @@ } } }, - "500": { + "default": { "description": "Unexpected error.", "content": { "application/problem+json": { diff --git a/docs/swagger/paths/v2_domains_redirects.json b/docs/swagger/paths/v2_domains_redirects.json index 5eee7cd6..d4d4338c 100644 --- a/docs/swagger/paths/v2_domains_redirects.json +++ b/docs/swagger/paths/v2_domains_redirects.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": { diff --git a/docs/swagger/paths/v2_mercure-info.json b/docs/swagger/paths/v2_mercure-info.json index b21322c3..a341573f 100644 --- a/docs/swagger/paths/v2_mercure-info.json +++ b/docs/swagger/paths/v2_mercure-info.json @@ -48,7 +48,7 @@ } } }, - "500": { + "default": { "description": "Unexpected error.", "content": { "application/problem+json": { diff --git a/docs/swagger/paths/v2_tags_{tag}_visits.json b/docs/swagger/paths/v2_tags_{tag}_visits.json index a6701850..109cb1d0 100644 --- a/docs/swagger/paths/v2_tags_{tag}_visits.json +++ b/docs/swagger/paths/v2_tags_{tag}_visits.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": { diff --git a/docs/swagger/paths/v2_visits.json b/docs/swagger/paths/v2_visits.json index 765d5eec..ded6ac6b 100644 --- a/docs/swagger/paths/v2_visits.json +++ b/docs/swagger/paths/v2_visits.json @@ -38,7 +38,7 @@ } } }, - "500": { + "default": { "description": "Unexpected error.", "content": { "application/problem+json": { diff --git a/docs/swagger/paths/v2_visits_orphan.json b/docs/swagger/paths/v2_visits_orphan.json index e2a10285..03d56553 100644 --- a/docs/swagger/paths/v2_visits_orphan.json +++ b/docs/swagger/paths/v2_visits_orphan.json @@ -137,7 +137,7 @@ } } }, - "500": { + "default": { "description": "Unexpected error.", "content": { "application/problem+json": { diff --git a/docs/swagger/paths/{shortCode}_qr-code.json b/docs/swagger/paths/{shortCode}_qr-code.json index 04a88fd7..104860eb 100644 --- a/docs/swagger/paths/{shortCode}_qr-code.json +++ b/docs/swagger/paths/{shortCode}_qr-code.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": {