Since Bug 16212 introduces a minification script, it could be useful for developers to have their specification automatically minified without the need to run minifier for each modification.
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.
*** This bug has been marked as a duplicate of bug 17432 ***