Bug 17102 - Automatically minify swagger.json
Summary: Automatically minify swagger.json
Status: RESOLVED DUPLICATE of bug 17432
Alias: None
Product: Koha
Classification: Unclassified
Component: Web services (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on: 16212
Blocks:
  Show dependency treegraph
 
Reported: 2016-08-10 12:33 UTC by Lari Taskula
Modified: 2016-10-16 11:33 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
Bug 17102: Automatically minify swagger.json (8.53 KB, patch)
2016-08-10 12:36 UTC, Lari Taskula
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Lari Taskula 2016-08-10 12:33:03 UTC
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.
Comment 1 Lari Taskula 2016-08-10 12:36:39 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.
Comment 2 Lari Taskula 2016-08-10 12:37:20 UTC
Perhaps some parametrization is needed, it is probably not a good idea to run this in production.
Comment 3 Tomás Cohen Arazi (tcohen) 2016-08-23 18:58:59 UTC
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.
Comment 4 Benjamin Rokseth 2016-09-05 09:13:47 UTC
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?
Comment 5 Tomás Cohen Arazi (tcohen) 2016-09-05 14:15:47 UTC
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.
Comment 6 Benjamin Rokseth 2016-09-08 11:35:41 UTC
I certainly agree. As long as we keep the minified swagger out of source control, I'm happy.
Comment 7 Katrin Fischer 2016-10-16 11:33:18 UTC

*** This bug has been marked as a duplicate of bug 17432 ***