From 7d6c6350bdef07b3b5577b3032d6911b99528f86 Mon Sep 17 00:00:00 2001 From: Lari Taskula Date: Tue, 14 Jun 2016 16:01:24 +0300 Subject: [PATCH] [SIGNED-OFF] Bug 16212: Use swagger.min.json insted of swagger.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Our current approach with splitting the Swagger specification brings problems. For example, in swagger.json, if we split the whole "definitions" object with $ref, validations will fail with online.swagger.io validator. (See http://online.swagger.io/validator/debug?url=url_to_your_swagger_json) The problem also occurs with "paths" (Paths Object), because simply $ref to all paths for example in /paths/index.json does not meet the Swagger2 specification. The problem is solved by using the minification script and the minified version of swagger.json after which the swagger.min.json is valid Swagger2 specification, because the minifier resolves the problematic $refs of swagger.json file in the minified version. Signed-off-by: Olli-Antti Kivilahti My name is Olli-Antti Kivilahti and I approve this commit. We have been using the Swagger2.0-driven REST API on Mojolicious for 1 year now in production and I am certain we have a pretty good idea on how to work with the limitations of Swagger2.0 Signed-off-by: Johanna Raisa My name is Johanna Räisä and I approve this commit. We have been using Swagger2.0-driven REST API in production successfully. --- Koha/REST/V1.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Koha/REST/V1.pm b/Koha/REST/V1.pm index b692a38..1bfda46 100644 --- a/Koha/REST/V1.pm +++ b/Koha/REST/V1.pm @@ -50,7 +50,7 @@ sub startup { $self->plugin(Swagger2 => { route => $route, - url => $self->home->rel_file("api/v1/swagger.json"), + url => $self->home->rel_file("api/v1/swagger.min.json"), }); } -- 1.9.1