Remove old error models and examples from swagger spec

This commit is contained in:
Alejandro Celaya 2024-02-28 08:39:26 +01:00
parent 33729289c7
commit c4805b8152
10 changed files with 19 additions and 78 deletions

View File

@ -1,9 +0,0 @@
{
"value": {
"title": "Invalid data",
"type": "INVALID_ARGUMENT",
"detail": "Provided data is not valid",
"status": 400,
"invalidElements": ["maxVisits", "validSince"]
}
}

View File

@ -1,9 +0,0 @@
{
"value": {
"detail": "No URL found with short code \"abc123\"",
"title": "Short URL not found",
"type": "INVALID_SHORTCODE",
"status": 404,
"shortCode": "abc123"
}
}

View File

@ -1,9 +0,0 @@
{
"value": {
"detail": "Tag with name \"foo\" could not be found",
"title": "Tag not found",
"type": "TAG_NOT_FOUND",
"status": 404,
"tag": "foo"
}
}

View File

@ -383,10 +383,10 @@
]
},
"examples": {
"Invalid arguments with API v3 and newer": {
"Invalid arguments": {
"$ref": "../examples/short-url-invalid-args-v3.json"
},
"Non-unique slug with API v3 and newer": {
"Non-unique slug": {
"value": {
"title": "Invalid custom slug",
"type": "https://shlink.io/api/error/non-unique-slug",
@ -394,18 +394,6 @@
"status": 400,
"customSlug": "my-slug"
}
},
"Invalid arguments previous to API v3": {
"$ref": "../examples/short-url-invalid-args-v2.json"
},
"Non-unique slug previous to API v3": {
"value": {
"title": "Invalid custom slug",
"type": "INVALID_SLUG",
"detail": "Provided slug \"my-slug\" is already in use.",
"status": 400,
"customSlug": "my-slug"
}
}
}
}

View File

@ -81,11 +81,8 @@
]
},
"examples": {
"API v3 and newer": {
"Short URL not found": {
"$ref": "../examples/short-url-not-found-v3.json"
},
"Previous to API v3": {
"$ref": "../examples/short-url-not-found-v2.json"
}
}
}
@ -202,11 +199,8 @@
]
},
"examples": {
"API v3 and newer": {
"Invalid arguments": {
"$ref": "../examples/short-url-invalid-args-v3.json"
},
"Previous to API v3": {
"$ref": "../examples/short-url-invalid-args-v2.json"
}
}
}
@ -238,11 +232,8 @@
]
},
"examples": {
"API v3 and newer": {
"Short URL not found": {
"$ref": "../examples/short-url-not-found-v3.json"
},
"Previous to API v3": {
"$ref": "../examples/short-url-not-found-v2.json"
}
}
}
@ -368,11 +359,8 @@
]
},
"examples": {
"API v3 and newer": {
"Short URL not found": {
"$ref": "../examples/short-url-not-found-v3.json"
},
"Previous to API v3": {
"$ref": "../examples/short-url-not-found-v2.json"
}
}
}

View File

@ -145,11 +145,8 @@
"$ref": "../definitions/Error.json"
},
"examples": {
"Short URL not found with API v3 and newer": {
"Short URL not found": {
"$ref": "../examples/short-url-not-found-v3.json"
},
"Short URL not found previous to API v3": {
"$ref": "../examples/short-url-not-found-v2.json"
}
}
}
@ -219,11 +216,8 @@
"$ref": "../definitions/Error.json"
},
"examples": {
"Short URL not found with API v3 and newer": {
"Short URL not found": {
"$ref": "../examples/short-url-not-found-v3.json"
},
"Short URL not found previous to API v3": {
"$ref": "../examples/short-url-not-found-v2.json"
}
}
}

View File

@ -228,9 +228,6 @@
"examples": {
"API v3 and newer": {
"$ref": "../examples/tag-not-found-v3.json"
},
"Previous to API v3": {
"$ref": "../examples/tag-not-found-v2.json"
}
}
}

View File

@ -148,12 +148,8 @@
"$ref": "../definitions/Error.json"
},
"examples": {
"API v3 and newer": {
"Tag not found": {
"$ref": "../examples/tag-not-found-v3.json"
},
"Previous to API v3": {
"$ref": "../examples/tag-not-found-v2.json"
}
}
}

View File

@ -29,7 +29,11 @@
"application/json": {
"schema": {
"type": "object",
"required": ["defaultLongUrl", "redirectRules"],
"properties": {
"defaultLongUrl": {
"type": "string"
},
"redirectRules": {
"type": "array",
"items": {
@ -39,6 +43,7 @@
}
},
"example": {
"defaultLongUrl": "https://example.com",
"redirectRules": [
{
"longUrl": "https://example.com/android-en-us",
@ -119,11 +124,8 @@
]
},
"examples": {
"API v3 and newer": {
"Short URL not found": {
"$ref": "../examples/short-url-not-found-v3.json"
},
"Previous to API v3": {
"$ref": "../examples/short-url-not-found-v2.json"
}
}
}

View File

@ -30,6 +30,9 @@ class ListRedirectRulesAction extends AbstractRestAction
);
$rules = $this->ruleService->rulesForShortUrl($shortUrl);
return new JsonResponse(['redirectRules' => $rules]);
return new JsonResponse([
'defaultLongUrl' => $shortUrl->getLongUrl(),
'redirectRules' => $rules,
]);
}
}