[Bug 16212] New: Swagger specification separation and minification
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 Bug ID: 16212 Summary: Swagger specification separation and minification Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Web services Assignee: koha-bugs@lists.koha-community.org Reporter: julian.maurice@biblibre.com QA Contact: testopia@bugs.koha-community.org Depends on: 15126 We should discuss how to split the Swagger spec, and whether or not we should minify it (and how). For more details, see the following comments: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15126#c5 https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15126#c6 https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15126#c26 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15126 [Bug 15126] REST API: Use newer version of Swagger2 -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 --- Comment #1 from Julian Maurice <julian.maurice@biblibre.com> --- Created attachment 49949 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=49949&action=edit Newest Swagger-spec validated 100% and pushed to production yay! Includes the swaggerMinifier.pl -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 --- Comment #2 from Julian Maurice <julian.maurice@biblibre.com> --- Created attachment 49950 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=49950&action=edit Bug 16212: Add script minifySwagger.pl -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |In Discussion -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 --- Comment #3 from Lari Taskula <larit@student.uef.fi> --- Created attachment 52368 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52368&action=edit Bug 16212: Move from misc/devel to api/v1 Move minifySwagger.pl from misc/devel to api/v1 since it is directly related to swagger.json and the usage is simplified when it is in the same location with swagger.json. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |larit@student.uef.fi --- Comment #4 from Lari Taskula <larit@student.uef.fi> --- If the change above is OK, I think also all Swagger-related stuff could be in api/v1/swagger. I'm working on Bug 16699 so maybe this can be done there. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |16699 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16699 [Bug 16699] Swagger: Split parameters and paths, and specify required permissions for resource -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 --- Comment #5 from Lari Taskula <larit@student.uef.fi> --- Created attachment 52369 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52369&action=edit Bug 16212: Use swagger.min.json insted of swagger.json 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. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 --- Comment #6 from Lari Taskula <larit@student.uef.fi> --- The minification is problematic at the moment, because it has to be executed manually. It could be assigned to execute automatically at Koha::REST::V1->startup(), but since this is executed on each request to the REST API, there will be a lot of useless computation. A dirty trick would be to make a copy of swagger.json and compare it to the actual swagger.json in startup(), and run swaggerMinifier.pl in case the two specification files are different, and finally replacing the copy with actual swagger.json. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 --- Comment #7 from Lari Taskula <larit@student.uef.fi> --- Created attachment 52576 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52576&action=edit Bug 16212: Automatically minify swagger.json This patch adds automatic minification of swagger.json. Since startup subroutine is executed on each call to REST API, we need to be careful to not do useless computation by minificating swagger.json when not required. Therefore, we need some algorithm to determine whether minification is needed. In this patch, minification is executed in two cases: 1. swagger.min.json does not exist 2. swagger.json is modified more recently than swagger.min.json Includes tests. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|In Discussion |Needs Signoff -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52576|0 |1 is obsolete| | --- Comment #8 from Lari Taskula <larit@student.uef.fi> --- Created attachment 52589 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52589&action=edit Bug 16212: Automatically minify swagger.json This patch adds automatic minification of swagger.json. Since startup subroutine is executed on each call to REST API, we need to be careful to not do useless computation by minificating swagger.json when not required. Therefore, we need some algorithm to determine whether minification is needed. In this patch, minification is executed in two cases: 1. swagger.min.json does not exist 2. any of the specification files is modified more recently than swagger.min.json Includes tests. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52589|0 |1 is obsolete| | --- Comment #9 from Lari Taskula <larit@student.uef.fi> --- Created attachment 52590 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52590&action=edit Bug 16212: Automatically minify swagger.json This patch adds automatic minification of swagger.json. Since startup subroutine is executed on each call to REST API, we need to be careful to not do useless computation by minificating swagger.json when not required. Therefore, we need some algorithm to determine whether minification is needed. In this patch, minification is executed in two cases: 1. swagger.min.json does not exist 2. any of the specification files is modified more recently than swagger.min.json Includes tests. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52590|0 |1 is obsolete| | --- Comment #10 from Lari Taskula <larit@student.uef.fi> --- Created attachment 52601 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52601&action=edit Bug 16212: Automatically minify swagger.json This patch adds automatic minification of swagger.json. Since startup subroutine is executed on each call to REST API, we need to be careful to not do useless computation by minificating swagger.json when not required. Therefore, we need some algorithm to determine whether minification is needed. In this patch, minification is executed in two cases: 1. swagger.min.json does not exist 2. any of the specification files is modified more recently than swagger.min.json Includes tests. This feature requires Apache user to have write permissions to swagger.min.json, otherwise we cannot minify the specification automatically. Another solution is to run the minifySwagger.pl manually after each modification or create a daemon that listens to file modifications via "inotify" and executes minification when needed. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52601|0 |1 is obsolete| | --- Comment #11 from Lari Taskula <larit@student.uef.fi> --- Created attachment 52651 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52651&action=edit Bug 16212: Automatically minify swagger.json This patch adds automatic minification of swagger.json. Since startup subroutine is executed on each call to REST API, we need to be careful to not do useless computation by minificating swagger.json when not required. Therefore, we need some algorithm to determine whether minification is needed. In this patch, minification is executed in two cases: 1. swagger.min.json does not exist 2. any of the specification files is modified more recently than swagger.min.json Includes tests. This feature requires Apache user to have write permissions to swagger.min.json, otherwise we cannot minify the specification automatically. Another solution is to run the minifySwagger.pl manually after each modification or create a daemon that listens to file modifications via "inotify" and executes minification when needed. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #49950|0 |1 is obsolete| | --- Comment #12 from Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> --- Created attachment 52952 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52952&action=edit Bug 16212: Add script minifySwagger.pl Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> 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 -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52368|0 |1 is obsolete| | --- Comment #13 from Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> --- Created attachment 52953 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52953&action=edit Bug 16212: Move from misc/devel to api/v1 Move minifySwagger.pl from misc/devel to api/v1 since it is directly related to swagger.json and the usage is simplified when it is in the same location with swagger.json. Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> 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 -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52369|0 |1 is obsolete| | --- Comment #14 from Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> --- Created attachment 52954 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52954&action=edit Bug 16212: Use swagger.min.json insted of swagger.json 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 <olli-antti.kivilahti@jns.fi> 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 -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52651|0 |1 is obsolete| | --- Comment #15 from Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> --- Created attachment 52955 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52955&action=edit Bug 16212: Automatically minify swagger.json This patch adds automatic minification of swagger.json. Since startup subroutine is executed on each call to REST API, we need to be careful to not do useless computation by minificating swagger.json when not required. Therefore, we need some algorithm to determine whether minification is needed. In this patch, minification is executed in two cases: 1. swagger.min.json does not exist 2. any of the specification files is modified more recently than swagger.min.json Includes tests. This feature requires Apache user to have write permissions to swagger.min.json, otherwise we cannot minify the specification automatically. Another solution is to run the minifySwagger.pl manually after each modification or create a daemon that listens to file modifications via "inotify" and executes minification when needed. Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> 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 -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off CC| |olli-antti.kivilahti@jns.fi -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 --- Comment #16 from Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> --- Created attachment 52968 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52968&action=edit [SIGNED-OFF] Bug 16212: Add script minifySwagger.pl Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> 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 <johanna.raisa@gmail.com> My name is Johanna Räisä and I approve this commit. We have been using Swagger2.0-driven REST API in production successfully. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 Johanna Räisä <johanna.raisa@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52968|0 |1 is obsolete| | --- Comment #17 from Johanna Räisä <johanna.raisa@gmail.com> --- Created attachment 52969 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52969&action=edit [SIGNED-OFF] Bug 16212: Add script minifySwagger.pl Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> 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 <johanna.raisa@gmail.com> My name is Johanna Räisä and I approve this commit. We have been using Swagger2.0-driven REST API in production successfully. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 --- Comment #18 from Johanna Räisä <johanna.raisa@gmail.com> --- Created attachment 52970 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52970&action=edit [SIGNED-OFF] Bug 16212: Move from misc/devel to api/v1 Move minifySwagger.pl from misc/devel to api/v1 since it is directly related to swagger.json and the usage is simplified when it is in the same location with swagger.json. Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> 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 <johanna.raisa@gmail.com> My name is Johanna Räisä and I approve this commit. We have been using Swagger2.0-driven REST API in production successfully. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 Johanna Räisä <johanna.raisa@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52954|0 |1 is obsolete| | --- Comment #19 from Johanna Räisä <johanna.raisa@gmail.com> --- Created attachment 52971 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52971&action=edit Bug 16212: Use swagger.min.json insted of swagger.json 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 <olli-antti.kivilahti@jns.fi> 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 <johanna.raisa@gmail.com> My name is Johanna Räisä and I approve this commit. We have been using Swagger2.0-driven REST API in production successfully. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 --- Comment #20 from Johanna Räisä <johanna.raisa@gmail.com> --- Created attachment 52972 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52972&action=edit [SIGNED-OFF] Bug 16212: Use swagger.min.json insted of swagger.json 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 <olli-antti.kivilahti@jns.fi> 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 <johanna.raisa@gmail.com> My name is Johanna Räisä and I approve this commit. We have been using Swagger2.0-driven REST API in production successfully. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 Johanna Räisä <johanna.raisa@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52955|0 |1 is obsolete| | --- Comment #21 from Johanna Räisä <johanna.raisa@gmail.com> --- Created attachment 52973 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52973&action=edit Bug 16212: Automatically minify swagger.json This patch adds automatic minification of swagger.json. Since startup subroutine is executed on each call to REST API, we need to be careful to not do useless computation by minificating swagger.json when not required. Therefore, we need some algorithm to determine whether minification is needed. In this patch, minification is executed in two cases: 1. swagger.min.json does not exist 2. any of the specification files is modified more recently than swagger.min.json Includes tests. This feature requires Apache user to have write permissions to swagger.min.json, otherwise we cannot minify the specification automatically. Another solution is to run the minifySwagger.pl manually after each modification or create a daemon that listens to file modifications via "inotify" and executes minification when needed. Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> 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 <johanna.raisa@gmail.com> My name is Johanna Räisä and I approve this commit. We have been using Swagger2.0-driven REST API in production successfully. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 Johanna Räisä <johanna.raisa@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52969|0 |1 is obsolete| | --- Comment #22 from Johanna Räisä <johanna.raisa@gmail.com> --- Created attachment 52982 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52982&action=edit [SIGNED-OFF] Bug 16212: Add script minifySwagger.pl Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> 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 <johanna.raisa@gmail.com> My name is Johanna Räisä and I approve this commit. We have been using Swagger2.0-driven REST API in production successfully. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 Johanna Räisä <johanna.raisa@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52970|0 |1 is obsolete| | --- Comment #23 from Johanna Räisä <johanna.raisa@gmail.com> --- Created attachment 52983 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52983&action=edit [SIGNED-OFF] Bug 16212: Move from misc/devel to api/v1 Move minifySwagger.pl from misc/devel to api/v1 since it is directly related to swagger.json and the usage is simplified when it is in the same location with swagger.json. Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> 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 <johanna.raisa@gmail.com> My name is Johanna Räisä and I approve this commit. We have been using Swagger2.0-driven REST API in production successfully. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 Johanna Räisä <johanna.raisa@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52972|0 |1 is obsolete| | --- Comment #24 from Johanna Räisä <johanna.raisa@gmail.com> --- Created attachment 52984 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52984&action=edit [SIGNED-OFF] Bug 16212: Use swagger.min.json insted of swagger.json 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 <olli-antti.kivilahti@jns.fi> 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 <johanna.raisa@gmail.com> My name is Johanna Räisä and I approve this commit. We have been using Swagger2.0-driven REST API in production successfully. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 --- Comment #25 from Johanna Räisä <johanna.raisa@gmail.com> --- Created attachment 52985 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52985&action=edit [SIGNED-OFF] Bug 16212: Automatically minify swagger.json This patch adds automatic minification of swagger.json. Since startup subroutine is executed on each call to REST API, we need to be careful to not do useless computation by minificating swagger.json when not required. Therefore, we need some algorithm to determine whether minification is needed. In this patch, minification is executed in two cases: 1. swagger.min.json does not exist 2. any of the specification files is modified more recently than swagger.min.json Includes tests. This feature requires Apache user to have write permissions to swagger.min.json, otherwise we cannot minify the specification automatically. Another solution is to run the minifySwagger.pl manually after each modification or create a daemon that listens to file modifications via "inotify" and executes minification when needed. Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> 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 <johanna.raisa@gmail.com> My name is Johanna Räisä and I approve this commit. We have been using Swagger2.0-driven REST API in production successfully. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52952|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52953|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52971|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52973|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |benjamin.rokseth@kul.oslo.k | |ommune.no --- Comment #26 from Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> --- Hi, as much as I would like to sign off this patch, I'm afraid I cannot agree on the notion of automatic minifying. It is an anti-pattern of production code, and requires too much quirks to my liking. a) It allows for inconsistency between apache/plack and minified/not minified b) It requires cgi/apache rights to write to swagger definitions, not a good idea. c) Plack also needs restarting/cache invalidation, since it caches swagger.json d) What is the problem of minifying before deploy anyways? Also I'm not sure of the need to minify swagger at all. If the only reason is for the online validation, I would argue that the online validation is the problem. More important is `mojo swagger2 validate`. Minifying swagger gives no extra performance opposed to http gzipped, probably the opposite. And it is unreadable. Hate to be the party killer, but if you consider removing the patch "Automatically minify swagger.json" I will sign off. Certainly if it means the splitting of definition and paths can be signed off, which I consider a very good idea. I don't consider the online validation an issue, but I do consider the problematic patching of large json files an issue. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 --- Comment #27 from Lari Taskula <larit@student.uef.fi> --- Hey Benjamin, thanks for the interest! I'm glad we share a desire to split our specification :) (In reply to Benjamin Rokseth from comment #26)
Also I'm not sure of the need to minify swagger at all. If the only reason is for the online validation, I would argue that the online validation is the problem. More important is `mojo swagger2 validate`. Our spec in master is not a valid Swagger spec, even if `mojo swagger2 validate` says so. Swagger specification does not support a reference whole Definitions-object in swagger.json like this:
"definitions": { "$ref": "./definitions/index.json" } That is super annoying, but I think we also want to validate against the online validator because it spots this issue. `mojo swagger2 validate` works (for now), but what if the plugin's validator is updated to consider this type of $ref invalid (as Swagger specification says)? We would have to place all definitions and paths in swagger.json, and at maximum $ref individual paths and definitions to external files, not the whole Paths / Definitions-object. I think Olli-Antti also encountered some other issues that this minifier fixes. Maybe he can comment more about it. Btw, I have opened an issue to Swagger2 plugin's GitHub to initiate some more discussion: https://github.com/jhthorsen/swagger2/issues/89 -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 --- Comment #28 from Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> --- (In reply to Lari Taskula from comment #27)
Hey Benjamin, thanks for the interest! I'm glad we share a desire to split our specification :)
(In reply to Benjamin Rokseth from comment #26)
Also I'm not sure of the need to minify swagger at all. If the only reason is for the online validation, I would argue that the online validation is the problem. More important is `mojo swagger2 validate`. Our spec in master is not a valid Swagger spec, even if `mojo swagger2 validate` says so. Swagger specification does not support a reference whole Definitions-object in swagger.json like this:
"definitions": { "$ref": "./definitions/index.json" }
That is super annoying, but I think we also want to validate against the online validator because it spots this issue. `mojo swagger2 validate` works (for now), but what if the plugin's validator is updated to consider this type of $ref invalid (as Swagger specification says)? We would have to place all definitions and paths in swagger.json, and at maximum $ref individual paths and definitions to external files, not the whole Paths / Definitions-object.
I think Olli-Antti also encountered some other issues that this minifier fixes. Maybe he can comment more about it.
Btw, I have opened an issue to Swagger2 plugin's GitHub to initiate some more discussion: https://github.com/jhthorsen/swagger2/issues/89
Lari, I engaged in your discussion at github, but to be sure, are we talking about the same thing? I test the swagger definitions at the online swagger validator and it obviously fails at relative and URI, as they are not resolvable to the validator. This is to be expected, but does not mean the definition is invalid. The only way to validate online in any case would be to first resolve all refs to one single json document. You refer to invalid refs in swagger specifications, but I only find this discussion in the swagger-ui -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 --- Comment #29 from Lari Taskula <larit@student.uef.fi> --- (In reply to Benjamin Rokseth from comment #28)
(In reply to Lari Taskula from comment #27)
Hey Benjamin, thanks for the interest! I'm glad we share a desire to split our specification :)
(In reply to Benjamin Rokseth from comment #26)
Also I'm not sure of the need to minify swagger at all. If the only reason is for the online validation, I would argue that the online validation is the problem. More important is `mojo swagger2 validate`. Our spec in master is not a valid Swagger spec, even if `mojo swagger2 validate` says so. Swagger specification does not support a reference whole Definitions-object in swagger.json like this:
"definitions": { "$ref": "./definitions/index.json" }
That is super annoying, but I think we also want to validate against the online validator because it spots this issue. `mojo swagger2 validate` works (for now), but what if the plugin's validator is updated to consider this type of $ref invalid (as Swagger specification says)? We would have to place all definitions and paths in swagger.json, and at maximum $ref individual paths and definitions to external files, not the whole Paths / Definitions-object.
I think Olli-Antti also encountered some other issues that this minifier fixes. Maybe he can comment more about it.
Btw, I have opened an issue to Swagger2 plugin's GitHub to initiate some more discussion: https://github.com/jhthorsen/swagger2/issues/89
Lari, I engaged in your discussion at github, but to be sure, are we talking about the same thing? I test the swagger definitions at the online swagger validator and it obviously fails at relative and URI, as they are not resolvable to the validator. This is to be expected, but does not mean the definition is invalid. The only way to validate online in any case would be to first resolve all refs to one single json document.
You refer to invalid refs in swagger specifications, but I only find this discussion in the swagger-ui I agree that the online swagger validator is unable to resolve relative references, but the original issue still exists. You can also write a single spec file with the problem in online validator, e.g.
{ "swagger": "2.0", "info": { "version": "0.1", "title" : "ref all paths/definitions" }, "paths": { "$ref": "#/x-def/paths" }, "definitions": { "$ref": "#/x-def/definitions" }, "x-def": { "definitions": { "patron": { "type": "object", "properties": { "borrowernumber": { "type": "string", "description": "internally assigned user identifier" } } } }, "paths": { "/patrons": { "get": { "responses" : { "200": { "description": "A list of patrons", "schema": { "type": "array", "items": { "$ref": "#/definitions/patron" } } } } } } } } } online.swagger.io validator will return: "attribute paths.$ref is not of type `object`", "attribute definitions.$ref is not of type `object`" `mojo swagger2 validate` works because it resolves all $refs before validation. The validation never sees a "$ref". When adjusted to not resolve $refs in our own spec, I got [JSON::Validator] type /paths _validate_type_object [/paths: Properties not allowed: $ref.] [JSON::Validator] type /definitions/$ref _validate_type_object [/definitions/$ref: Expected object - got string.] To make this spec pass validation (both online validator and adjusted case of JSON::Validator), we need to $ref individual paths and definitions instead, e.g.: { "swagger": "2.0", "info": { "version": "0.1", "title" : "ref individual paths/definitions" }, "paths": { "/patrons": { "$ref": "#/x-def/paths/patrons" } }, "definitions": { "patron": { "$ref": "#/x-def/definitions/patron" } }, "x-def": { "definitions": { "patron": { "type": "object", "properties": { "borrowernumber": { "type": "string", "description": "internally assigned user identifier" } } } }, "paths": { "patrons": { "get": { "responses" : { "200": { "description": "A list of patrons", "schema": { "type": "array", "items": { "$ref": "#/definitions/patron" } } } } } } } } } This issue is referred also elsewhere than swagger-ui, here are some links: https://github.com/mission-liao/pyswagger/issues/53#issuecomment-168872441 (also points to OpenAPI Specification, "@webron: You can reference specific http verb operations, not full sets of paths.") swagger-parser comment on the article about splitting spec: https://github.com/swagger-api/swagger-parser/issues/87#issuecomment-1402800... It's just some of the annoying features in Swagger. It also looks like the author of Swagger2/OpenAPI plugin has commited this change in the new OpenAPI plugin https://github.com/jhthorsen/mojolicious-plugin-openapi/commit/7d804c58eae51... and I guess this means that in the future our current spec will not validate without first resolving all the $refs with (for example) this minifier script. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 --- Comment #30 from Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> --- So, I'm not able to grasp the problems in swagger splitting specifications. Since the specs seem to be maintained, it's probably best to minify before validation, so the $ref problem is gone. The main point is to keep the specs in an understandable (and patchable) structure. Anyways, I still disagree on the automatic minifying. It has no place in production code, since the specs should be static there in any case. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 --- Comment #31 from Lari Taskula <larit@student.uef.fi> --- (In reply to Benjamin Rokseth from comment #30)
The main point is to keep the specs in an understandable (and patchable) structure. Completely agree on this.
Anyways, I still disagree on the automatic minifying. It has no place in production code, since the specs should be static there in any case. Perhaps it could be parametrized to be enabled / disabled, but for now I think
It's unfortunate that Swagger has limitations that make it more complicated for us. the best action is to obsolete that patch. Thanks for your comments and engagement in discussion both here and GitHub, Benjamin, I really appreciate it! -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52985|0 |1 is obsolete| | -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |17102 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17102 [Bug 17102] Automatically minify swagger.json -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 --- Comment #32 from Lari Taskula <larit@student.uef.fi> --- (In reply to Lari Taskula from comment #31)
Anyways, I still disagree on the automatic minifying. It has no place in production code, since the specs should be static there in any case. Perhaps it could be parametrized to be enabled / disabled, but for now I think the best action is to obsolete that patch. Moved to Bug 17102.
-- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 --- Comment #33 from Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> --- Created attachment 54286 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=54286&action=edit Bug 16212: Add script minifySwagger.pl Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> 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 <johanna.raisa@gmail.com> My name is Johanna Räisä and I approve this commit. We have been using Swagger2.0-driven REST API in production successfully. Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 --- Comment #34 from Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> --- Created attachment 54287 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=54287&action=edit Bug 16212: Move from misc/devel to api/v1 Move minifySwagger.pl from misc/devel to api/v1 since it is directly related to swagger.json and the usage is simplified when it is in the same location with swagger.json. Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> 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 <johanna.raisa@gmail.com> My name is Johanna Räisä and I approve this commit. We have been using Swagger2.0-driven REST API in production successfully. Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 --- Comment #35 from Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> --- Created attachment 54288 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=54288&action=edit Bug 16212: Use swagger.min.json insted of swagger.json 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 <olli-antti.kivilahti@jns.fi> 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 <johanna.raisa@gmail.com> My name is Johanna Räisä and I approve this commit. We have been using Swagger2.0-driven REST API in production successfully. Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52982|0 |1 is obsolete| | -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52983|0 |1 is obsolete| | -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52984|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 --- Comment #36 from Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> --- Tests: swagger.json: curl -X POST -H "accept:application/json" -d @swagger.json http://online.swagger.io/validator/debug {"messages":["attribute definitions.$ref is not of type `object`"],"schemaValidationMessages":[{"level":"error","domain":"validation","keyword":"type","message":"instance type (string) does not match any allowed primitive type (allowed: [\"object\"])","schema":{"loadingURI":"http://swagger.io/v2/schema.json#","pointer":"/definitions/schema"},"instance":{"pointer":"/definitions/$ref"}}]} swagger.min.json curl -X POST -H "accept:application/json" -d @swagger.min.json http://online.swagger.io/validator/debug {} -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks|16699 | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16699 [Bug 16699] Swagger: Split parameters and paths, and specify required permissions for resource -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |16699 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16699 [Bug 16699] Swagger: Split parameters and paths, and specify required permissions for resource -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tomascohen@gmail.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #54287|0 |1 is obsolete| | -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #54286|0 |1 is obsolete| | --- Comment #37 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 54870 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=54870&action=edit Bug 16212: Add script minifySwagger.pl This patch introduces the misc/devel/minifySwagger.pl script that loads the Swagger files, follows references and produces a compact ("minified") version of the swagger file which is suitable for distribution. The wiki page should be updated with instructions on how to regenerate it so the Release Manager does it on each spec upgrade. Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> 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 <johanna.raisa@gmail.com> My name is Johanna Räisä and I approve this commit. We have been using Swagger2.0-driven REST API in production successfully. Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #54288|0 |1 is obsolete| | --- Comment #38 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 54871 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=54871&action=edit Bug 16212: Use swagger.min.json insted of swagger.json 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 <olli-antti.kivilahti@jns.fi> 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 <johanna.raisa@gmail.com> My name is Johanna Räisä and I approve this commit. We have been using Swagger2.0-driven REST API in production successfully. Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #54870|0 |1 is obsolete| | --- Comment #39 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 54872 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=54872&action=edit Bug 16212: Add script minifySwagger.pl This patch introduces the misc/devel/minifySwagger.pl script that loads the Swagger files, follows references and produces a compact ("minified") version of the swagger file which is suitable for distribution. The wiki page should be updated with instructions on how to regenerate it so the Release Manager does it on each spec upgrade. Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> 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 <johanna.raisa@gmail.com> My name is Johanna Räisä and I approve this commit. We have been using Swagger2.0-driven REST API in production successfully. Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Small patch -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #54871|0 |1 is obsolete| | --- Comment #40 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 54873 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=54873&action=edit Bug 16212: Use swagger.min.json insted of swagger.json 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 <olli-antti.kivilahti@jns.fi> 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 <johanna.raisa@gmail.com> My name is Johanna Räisä and I approve this commit. We have been using Swagger2.0-driven REST API in production successfully. Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 --- Comment #41 from Tomás Cohen Arazi <tomascohen@gmail.com> --- I've moved the minifySwagger.pl script back to misc/devel as it is similar to how we handle the DBIx schema files. @RM: Beware you need to create the minified file before pushing this patches, as it would otherwise break the REST api (which points to the minified version with this patchset): $ misc/devel/minifySwagger.pl --source api/v1/swagger.json --destination api/v1/swagger.min.json -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to Master CC| |kyle@bywatersolutions.com --- Comment #42 from Kyle M Hall <kyle@bywatersolutions.com> --- Pushed to master for 16.11, thanks Julian, Lari! -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 Bug 16212 depends on bug 15126, which changed state. Bug 15126 Summary: REST API: Use newer version of Swagger2 https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15126 What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to Master |RESOLVED Resolution|--- |FIXED -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |17432 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17432 [Bug 17432] Remove requirement to minify swagger.json -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |17694 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17694 [Bug 17694] Add human friendly REST documentation -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks|17694 | Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17694 [Bug 17694] Add human friendly REST documentation -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org