From c7cfdffaf67541d03e208a08a33da7073927cec6 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya <alejandro@alejandrocelaya.com> Date: Mon, 8 Jul 2019 18:42:53 +0200 Subject: [PATCH] Documented new meta param on swagger docs --- docs/swagger/definitions/ShortUrl.json | 3 ++ docs/swagger/definitions/ShortUrlMeta.json | 21 ++++++++++++++ docs/swagger/paths/v1_short-urls.json | 28 ++++++++++++++++--- docs/swagger/paths/v1_short-urls_shorten.json | 7 ++++- .../paths/v1_short-urls_{shortCode}.json | 7 ++++- 5 files changed, 60 insertions(+), 6 deletions(-) create mode 100644 docs/swagger/definitions/ShortUrlMeta.json diff --git a/docs/swagger/definitions/ShortUrl.json b/docs/swagger/definitions/ShortUrl.json index 14cd0fe5..9b259249 100644 --- a/docs/swagger/definitions/ShortUrl.json +++ b/docs/swagger/definitions/ShortUrl.json @@ -29,6 +29,9 @@ }, "description": "A list of tags applied to this short URL" }, + "meta": { + "$ref": "./ShortUrlMeta.json" + }, "originalUrl": { "deprecated": true, "type": "string", diff --git a/docs/swagger/definitions/ShortUrlMeta.json b/docs/swagger/definitions/ShortUrlMeta.json new file mode 100644 index 00000000..370a548b --- /dev/null +++ b/docs/swagger/definitions/ShortUrlMeta.json @@ -0,0 +1,21 @@ +{ + "type": "object", + "required": ["validSince", "validUntil", "maxVisits"], + "properties": { + "validSince": { + "description": "The date (in ISO-8601 format) from which this short code will be valid", + "type": "string", + "nullable": true + }, + "validUntil": { + "description": "The date (in ISO-8601 format) until which this short code will be valid", + "type": "string", + "nullable": true + }, + "maxVisits": { + "description": "The maximum number of allowed visits for this short code", + "type": "number", + "nullable": true + } + } +} diff --git a/docs/swagger/paths/v1_short-urls.json b/docs/swagger/paths/v1_short-urls.json index e55b1162..2254a732 100644 --- a/docs/swagger/paths/v1_short-urls.json +++ b/docs/swagger/paths/v1_short-urls.json @@ -100,7 +100,12 @@ "tags": [ "games", "tech" - ] + ], + "meta": { + "validSince": "2017-01-21T00:00:00+02:00", + "validUntil": null, + "maxVisits": 100 + } }, { "shortCode": "12Kb3", @@ -110,7 +115,12 @@ "visitsCount": 1029, "tags": [ "shlink" - ] + ], + "meta": { + "validSince": null, + "validUntil": null, + "maxVisits": null + } }, { "shortCode": "123bA", @@ -118,7 +128,12 @@ "longUrl": "https://www.google.com", "dateCreated": "2015-10-01T20:34:16+02:00", "visitsCount": 25, - "tags": [] + "tags": [], + "meta": { + "validSince": "2017-01-21T00:00:00+02:00", + "validUntil": null, + "maxVisits": null + } } ], "pagination": { @@ -227,7 +242,12 @@ "tags": [ "games", "tech" - ] + ], + "meta": { + "validSince": "2017-01-21T00:00:00+02:00", + "validUntil": null, + "maxVisits": 500 + } } } }, diff --git a/docs/swagger/paths/v1_short-urls_shorten.json b/docs/swagger/paths/v1_short-urls_shorten.json index 00af215d..803d77d5 100644 --- a/docs/swagger/paths/v1_short-urls_shorten.json +++ b/docs/swagger/paths/v1_short-urls_shorten.json @@ -64,7 +64,12 @@ "tags": [ "games", "tech" - ] + ], + "meta": { + "validSince": "2017-01-21T00:00:00+02:00", + "validUntil": null, + "maxVisits": 100 + } }, "text/plain": "https://doma.in/abc123" } diff --git a/docs/swagger/paths/v1_short-urls_{shortCode}.json b/docs/swagger/paths/v1_short-urls_{shortCode}.json index c312db8a..41d1499c 100644 --- a/docs/swagger/paths/v1_short-urls_{shortCode}.json +++ b/docs/swagger/paths/v1_short-urls_{shortCode}.json @@ -44,7 +44,12 @@ "visitsCount": 1029, "tags": [ "shlink" - ] + ], + "meta": { + "validSince": "2017-01-21T00:00:00+02:00", + "validUntil": null, + "maxVisits": 100 + } } } },