Summary: | Automatically minify swagger.json | ||
---|---|---|---|
Product: | Koha | Reporter: | Lari Taskula <lari.taskula> |
Component: | Web services | Assignee: | Bugs List <koha-bugs> |
Status: | RESOLVED DUPLICATE | QA Contact: | Testopia <testopia> |
Severity: | enhancement | ||
Priority: | P5 - low | CC: | benjamin.rokseth, tomascohen |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
See Also: | https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17432 | ||
Change sponsored?: | --- | Patch complexity: | --- |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: | ||
Circulation function: | |||
Bug Depends on: | 16212 | ||
Bug Blocks: | |||
Attachments: | Bug 17102: Automatically minify swagger.json |
Description
Lari Taskula
2016-08-10 12:33:03 UTC
Created attachment 54269 [details] [review] Bug 17102: 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. Perhaps some parametrization is needed, it is probably not a good idea to run this in production. I think this workflow wouldn't fit into Koha's QA process. And as you said, it shouldn't be encouraged in production. BUT maybe we could make kohadevbox have this as a feature for developers. Just started a discussion on Bug 17243 on minifying swagger. Basically I propose adding it to the plack build sub of the api. Any thoughts on this? I don't think we should automatically regenerate it. The deployed file should be production ready and no source of issues for end-users. It looks to me that we just need to provide ways for devs to set that if needed. Be it under kohadevbox or on regular dev setups. I certainly agree. As long as we keep the minified swagger out of source control, I'm happy. |