From 78f75a06df492e5eb3b04135468a5f1098e296c1 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sat, 1 Jul 2023 16:56:07 +0200 Subject: [PATCH 1/4] Updated swagger docs to v3.1, and fixed some 'required' definitions --- composer.json | 2 +- docs/swagger/definitions/DeviceLongUrls.json | 9 +++------ docs/swagger/definitions/DeviceLongUrlsEdit.json | 6 +++--- docs/swagger/swagger.json | 2 +- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/composer.json b/composer.json index ba72eed1..3a970ee5 100644 --- a/composer.json +++ b/composer.json @@ -63,7 +63,7 @@ "symfony/string": "^6.2" }, "require-dev": { - "cebe/php-openapi": "^1.7", + "devizzent/cebe-php-openapi": "dev-I-5_server_definition_fix as 1.1", "devster/ubench": "^2.1", "infection/infection": "^0.27", "openswoole/ide-helper": "~22.0.0", diff --git a/docs/swagger/definitions/DeviceLongUrls.json b/docs/swagger/definitions/DeviceLongUrls.json index 1a56d9ef..0e8719db 100644 --- a/docs/swagger/definitions/DeviceLongUrls.json +++ b/docs/swagger/definitions/DeviceLongUrls.json @@ -3,18 +3,15 @@ "properties": { "android": { "description": "The long URL to redirect to when the short URL is visited from a device running Android", - "type": "string", - "nullable": false + "type": ["string"] }, "ios": { "description": "The long URL to redirect to when the short URL is visited from a device running iOS", - "type": "string", - "nullable": false + "type": ["string"] }, "desktop": { "description": "The long URL to redirect to when the short URL is visited from a desktop browser", - "type": "string", - "nullable": false + "type": ["string"] } } } diff --git a/docs/swagger/definitions/DeviceLongUrlsEdit.json b/docs/swagger/definitions/DeviceLongUrlsEdit.json index 78f77e46..f1ff255f 100644 --- a/docs/swagger/definitions/DeviceLongUrlsEdit.json +++ b/docs/swagger/definitions/DeviceLongUrlsEdit.json @@ -5,13 +5,13 @@ }], "properties": { "android": { - "nullable": true + "type": ["null"] }, "ios": { - "nullable": true + "type": ["null"] }, "desktop": { - "nullable": true + "type": ["null"] } } } diff --git a/docs/swagger/swagger.json b/docs/swagger/swagger.json index b80ae3b2..51655ecf 100644 --- a/docs/swagger/swagger.json +++ b/docs/swagger/swagger.json @@ -1,5 +1,5 @@ { - "openapi": "3.0.3", + "openapi": "3.1.0", "info": { "title": "Shlink", "description": "Shlink, the self-hosted URL shortener", From ad1a846d8e6b4ca39f720aeaa4c29a9bc20726ed Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sat, 1 Jul 2023 17:04:24 +0200 Subject: [PATCH 2/4] Remove references to nullable in OAS --- docs/swagger/definitions/NotFoundRedirects.json | 9 +++------ docs/swagger/definitions/OrphanVisit.json | 3 +-- docs/swagger/definitions/ShortUrl.json | 6 ++---- docs/swagger/definitions/ShortUrlEdition.json | 14 +++++--------- docs/swagger/definitions/ShortUrlMeta.json | 9 +++------ 5 files changed, 14 insertions(+), 27 deletions(-) diff --git a/docs/swagger/definitions/NotFoundRedirects.json b/docs/swagger/definitions/NotFoundRedirects.json index 6887ed0c..d0459f90 100644 --- a/docs/swagger/definitions/NotFoundRedirects.json +++ b/docs/swagger/definitions/NotFoundRedirects.json @@ -2,18 +2,15 @@ "type": "object", "properties": { "baseUrlRedirect": { - "type": "string", - "nullable": true, + "type": ["string", "null"], "description": "URL to redirect to when a user hits the domain's base URL" }, "regular404Redirect": { - "type": "string", - "nullable": true, + "type": ["string", "null"], "description": "URL to redirect to when a user hits a not found URL other than an invalid short URL" }, "invalidShortUrlRedirect": { - "type": "string", - "nullable": true, + "type": ["string", "null"], "description": "URL to redirect to when a user hits an invalid short URL" } } diff --git a/docs/swagger/definitions/OrphanVisit.json b/docs/swagger/definitions/OrphanVisit.json index 04d8386d..a8b4954a 100644 --- a/docs/swagger/definitions/OrphanVisit.json +++ b/docs/swagger/definitions/OrphanVisit.json @@ -6,8 +6,7 @@ }], "properties": { "visitedUrl": { - "type": "string", - "nullable": true, + "type": ["string", "null"], "description": "The originally visited URL that triggered the tracking of this visit" }, "type": { diff --git a/docs/swagger/definitions/ShortUrl.json b/docs/swagger/definitions/ShortUrl.json index 4060e2f2..98fd9c87 100644 --- a/docs/swagger/definitions/ShortUrl.json +++ b/docs/swagger/definitions/ShortUrl.json @@ -55,13 +55,11 @@ "$ref": "./ShortUrlMeta.json" }, "domain": { - "type": "string", - "nullable": true, + "type": ["string", "null"], "description": "The domain in which the short URL was created. Null if it belongs to default domain." }, "title": { - "type": "string", - "nullable": true, + "type": ["string", "null"], "description": "A descriptive title of the short URL." }, "crawlable": { diff --git a/docs/swagger/definitions/ShortUrlEdition.json b/docs/swagger/definitions/ShortUrlEdition.json index ed3c3929..dda213ca 100644 --- a/docs/swagger/definitions/ShortUrlEdition.json +++ b/docs/swagger/definitions/ShortUrlEdition.json @@ -10,18 +10,15 @@ }, "validSince": { "description": "The date (in ISO-8601 format) from which this short code will be valid", - "type": "string", - "nullable": true + "type": ["string", "null"] }, "validUntil": { "description": "The date (in ISO-8601 format) until which this short code will be valid", - "type": "string", - "nullable": true + "type": ["string", "null"] }, "maxVisits": { "description": "The maximum number of allowed visits for this short code", - "type": "number", - "nullable": true + "type": ["number", "null"] }, "validateUrl": { "deprecated": true, @@ -36,9 +33,8 @@ "description": "The list of tags to set to the short URL." }, "title": { - "type": "string", - "description": "A descriptive title of the short URL.", - "nullable": true + "type": ["string", "null"], + "description": "A descriptive title of the short URL." }, "crawlable": { "type": "boolean", diff --git a/docs/swagger/definitions/ShortUrlMeta.json b/docs/swagger/definitions/ShortUrlMeta.json index 370a548b..d687d97f 100644 --- a/docs/swagger/definitions/ShortUrlMeta.json +++ b/docs/swagger/definitions/ShortUrlMeta.json @@ -4,18 +4,15 @@ "properties": { "validSince": { "description": "The date (in ISO-8601 format) from which this short code will be valid", - "type": "string", - "nullable": true + "type": ["string", "null"] }, "validUntil": { "description": "The date (in ISO-8601 format) until which this short code will be valid", - "type": "string", - "nullable": true + "type": ["string", "null"] }, "maxVisits": { "description": "The maximum number of allowed visits for this short code", - "type": "number", - "nullable": true + "type": ["number", "null"] } } } From 27e90c4c261754a1ef60308a235a7d8e904bd21b Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Sat, 1 Jul 2023 17:15:20 +0200 Subject: [PATCH 3/4] Update changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 381021fb..e5a78e82 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com), and this For example, if you did not enable RabbitMQ real-time updates, instead of triggering a job that ends immediately, the job will not even be enqueued. * [#1835](https://github.com/shlinkio/shlink/issues/1835) Docker image is now built only when a release is tagged, and new tags are included, for minor and major versions. +* [#1055](https://github.com/shlinkio/shlink/issues/1055) Update OAS definition to v3.1. ### Deprecated * [#1783](https://github.com/shlinkio/shlink/issues/1783) Deprecated support for openswoole. RoadRunner is the best replacement, with the same capabilities, but much easier and convenient to install and manage. From b47bd0fc7ae1c523d31eef6921fddb5965e342e1 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Wed, 12 Jul 2023 11:33:58 +0200 Subject: [PATCH 4/4] Use stable version of devizzent/cebe-php-openapi --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 3a970ee5..d9e0e63f 100644 --- a/composer.json +++ b/composer.json @@ -63,7 +63,7 @@ "symfony/string": "^6.2" }, "require-dev": { - "devizzent/cebe-php-openapi": "dev-I-5_server_definition_fix as 1.1", + "devizzent/cebe-php-openapi": "^1.0.1", "devster/ubench": "^2.1", "infection/infection": "^0.27", "openswoole/ide-helper": "~22.0.0",