[Bug 17243] New: git ignore swagger.min.json
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17243 Bug ID: 17243 Summary: git ignore swagger.min.json 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: benjamin.rokseth@kul.oslo.kommune.no QA Contact: testopia@bugs.koha-community.org With the advent of the new Koha REST API and recently Bug 16699 and Bug 14868, the minified version of the swagger definitions has snuck into the code. A bad, but understandable idea. However it will make patching a nightmare, so I propose in this patch to add swagger.min.json to .gitignore and shift the responsibility of minifying elsewhere. Specific use case: patching two independent bugs on the rest API will fail, as both bugs will need to modify the same swagger.min.json. Pros: extensible patching on the API will be possible, as was the main bonus of Bug 16699, and is probably going to be the real life use of the API for some time. Cons: minifySwagger.pl must be run manually, and plack restarted, to pick up changes. This is sysop/deployment responsibility anyways. Alternatively, Bug 17102 can be used to automate minifying. -- 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=17243 --- Comment #1 from Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> --- Created attachment 55145 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=55145&action=edit Bug 17243 - git ignore swagger.min.json This patch adds *.min.json to .gitignore in swagger dir. To remove tracking of swagger.min.json run git update-index --assume-unchanged swagger.min.json Or just ignore uncommitted changes -- 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=17243 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |katrin.fischer@bsz-bw.de --- Comment #2 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Could we deal with it similarly as with the OPAC CSS files? (https://wiki.koha-community.org/wiki/Working_with_Bootstrap_OPAC_LESS_files) I am not sure how this change would affect RM and packaging manager or the end users. Who will generate the minified file and when? -- 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=17243 Zeno Tajoli <z.tajoli@cineca.it> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff CC| |z.tajoli@cineca.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=17243 --- Comment #3 from Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> --- Well, good question, many possible answers. Lari proposed in Bug 17102 an alternative to use inotify and a running daemon to pick up changes. I think, by now, plack should be on by default? At least it is necessary if using the api. Then it would perhaps make sense to build/update the swagger definitions on plack start/restart? It should be an easy patch, since the api has its own builder in plack.psgi. -- 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=17243 --- Comment #4 from Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> --- Thinking more of it, I would recommend the plack build solution. Something in the line of adding a sub to plack.psgi: sub minifySwagger { use Swagger2; my $swagger = Swagger2->new('/usr/share/koha/api/v1/swagger/swagger.json'); $swagger = $swagger->expand; #Fetch all JSON-Schema references my $data = $swagger->api_spec->data; delete($data->{id}); # delete non-valid "/id" open(SWOUT, ">:encoding(UTF-8)", '/usr/share/koha/api/v1/swagger/swagger.min.json') print SWOUT $swagger->to_string(); close(SWOUT); } and calling it inside the build method of the api. Obviously with some error-handling and relative paths. Thoughts? -- 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=17243 Magnus Enger <magnus@libriotech.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |In Discussion CC| |magnus@libriotech.no --- Comment #5 from Magnus Enger <magnus@libriotech.no> --- Looks like the patch submitter is recommending a different solution than the one in the patch? Setting to "In discussion". -- 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=17243 Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|In Discussion |Needs Signoff --- Comment #6 from Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> --- Actually, bug 17102 discusses the alternatives. This patch simply removes the minified swagger from source control, which I think is important. Setting back to need signoff and urge the discussion to move forward in 17102 ;) -- 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=17243 --- Comment #7 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- I've added this bug to the next dev meeting's agenda. -- 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=17243 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart@bugs.koha-c | |ommunity.org --- Comment #8 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- We could imagine an "environment" pref (or in the config) with 2 values "dev" or "prod" (default "prod"). If "prod", the minified files are used (otherwise the non-minified). This could work for the css and swaggger min files. The RM(aints) will have to regenerated the min fils before each releases (automatically), but nothing to do for devs (no need to regenerated them) nor for testers (no conflict). -- 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=17243 --- Comment #9 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Hi Jonathan, if that works, I am all for it! -- 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=17243 --- Comment #10 from Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> --- (In reply to Jonathan Druart from comment #8)
We could imagine an "environment" pref (or in the config) with 2 values "dev" or "prod" (default "prod"). If "prod", the minified files are used (otherwise the non-minified). This could work for the css and swaggger min files. The RM(aints) will have to regenerated the min fils before each releases (automatically), but nothing to do for devs (no need to regenerated them) nor for testers (no conflict).
That is a very sensible suggestion! Also since it is a general solution that can be used any other place where compilation/minifying/regeneration would be neccessary in the future. Especially in the javascript world and the coming of ES6 this would make sense, as it would cover the need of browser shims and transpilation to code that works across browsers. -- 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=17243 Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|Needs Signoff |RESOLVED --- Comment #11 from Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> --- No longer neccessary, due to Bug 17432. -- 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