[Koha-bugs] [Bug 17243] git ignore swagger.min.json

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Sep 5 11:11:15 CEST 2016


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17243

--- Comment #4 from Benjamin Rokseth <benjamin.rokseth at 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.


More information about the Koha-bugs mailing list