Summary: | Add bibliographic content type definitions | ||
---|---|---|---|
Product: | Koha | Reporter: | Tomás Cohen Arazi <tomascohen> |
Component: | REST API | Assignee: | Tomás Cohen Arazi <tomascohen> |
Status: | CLOSED FIXED | QA Contact: | Josef Moravec <josef.moravec> |
Severity: | enhancement | ||
Priority: | P5 - low | CC: | adamgrayling, black23, fridolin.somers, josef.moravec, martin.renvoize, nick |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
See Also: | https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=21116 | ||
Change sponsored?: | --- | Patch complexity: | --- |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: | ||
Bug Depends on: | |||
Bug Blocks: | 17371 | ||
Attachments: |
Bug 21334: Unit tests
Bug 21334: Add bibliographic content type definitions Bug 21334: Add bibliographic content type definitions Bug 21334: Add bibliographic content type definitions Bug 21334: Unit tests Bug 21334: Add bibliographic content type definitions |
Description
Tomás Cohen Arazi
2018-09-11 17:31:31 UTC
Created attachment 78563 [details] [review] Bug 21334: Unit tests This patch adds unit tests for the new content types being added. It also adds tests for the 'json' overloading that already takes place in V1.pm. Created attachment 78564 [details] [review] Bug 21334: Add bibliographic content type definitions This patch adds the following content type definitions, to be used by endpoint authors implementing MARC-related endpoints: -------------------------------------- | Content-type | Alias | |--------------------------|---------| | application/marcxml+xml | marcxml | | application/marc-in-json | mij | | application/marc | marc | -------------------------------------- Code using this aliases will use them like this: - Suppose you want to output data in MARCXML format: my $record = cool_method_that_returns_MARC_RECORD(); return $c->render( status => 200, text => $record->as_xml_record ); Note: 'text' by defaults encodes output as UTF-8. If the encoding is not UTF-8 you should encode the data on your own. To test: - Apply this patches - Run: $ kshell k$ prove t/db_dependent/Koha/REST/V1.t => SUCCESS: Test pass! - Sign off :-D Created attachment 78565 [details] [review] Bug 21334: Add bibliographic content type definitions This patch adds the following content type definitions, to be used by endpoint authors implementing MARC-related endpoints: -------------------------------------- | Content-type | Alias | |--------------------------|---------| | application/marcxml+xml | marcxml | | application/marc-in-json | mij | | application/marc | marc | -------------------------------------- Code using this aliases will use them like this: - Suppose you want to output data in MARCXML format: my $record = cool_method_that_returns_MARC_RECORD(); return $c->render( status => 200, format => 'marcxml', text => $record->as_xml_record ); Note: 'text' by defaults encodes output as UTF-8. If the encoding is not UTF-8 you should encode the data on your own. To test: - Apply this patches - Run: $ kshell k$ prove t/db_dependent/Koha/REST/V1.t => SUCCESS: Test pass! - Sign off :-D Fixed minor mistake on usage explanation. Created attachment 78585 [details] [review] Bug 21334: Add bibliographic content type definitions This patch adds the following content type definitions, to be used by endpoint authors implementing MARC-related endpoints: -------------------------------------- | Content-type | Alias | |--------------------------|---------| | application/marcxml+xml | marcxml | | application/marc-in-json | mij | | application/marc | marc | -------------------------------------- Code using this aliases will use them like this: - Suppose you want to output data in MARCXML format: my $record = cool_method_that_returns_MARC_RECORD(); return $c->render( status => 200, format => 'marcxml', text => $record->as_xml_record ); Note: 'text' by defaults encodes output as UTF-8. If the encoding is not UTF-8 you should encode the data on your own. To test: - Apply this patches - Run: $ kshell k$ prove t/db_dependent/Koha/REST/V1.t => SUCCESS: Test pass! - Sign off :-D Signed-off-by: Michal Denar <black23@gail.com> Created attachment 78599 [details] [review] Bug 21334: Unit tests This patch adds unit tests for the new content types being added. It also adds tests for the 'json' overloading that already takes place in V1.pm. Signed-off-by: Michal Denar <black23@gmail.com> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Created attachment 78600 [details] [review] Bug 21334: Add bibliographic content type definitions This patch adds the following content type definitions, to be used by endpoint authors implementing MARC-related endpoints: -------------------------------------- | Content-type | Alias | |--------------------------|---------| | application/marcxml+xml | marcxml | | application/marc-in-json | mij | | application/marc | marc | -------------------------------------- Code using this aliases will use them like this: - Suppose you want to output data in MARCXML format: my $record = cool_method_that_returns_MARC_RECORD(); return $c->render( status => 200, format => 'marcxml', text => $record->as_xml_record ); Note: 'text' by defaults encodes output as UTF-8. If the encoding is not UTF-8 you should encode the data on your own. To test: - Apply this patches - Run: $ kshell k$ prove t/db_dependent/Koha/REST/V1.t => SUCCESS: Test pass! - Sign off :-D Signed-off-by: Michal Denar <black23@gmail.com> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Awesome work all! Pushed to master for 18.11 Enhancement, will not be backported to 18.05.x series. Pushed to 18.05.x for 18.05.04. After pushing bug 21116 I decided this one warranted backporting for the same reasons outlined on that bug. Enhancement not pushed to 17.11.x (In reply to Josef Moravec from comment #7) > Created attachment 78600 [details] [review] [review] > Bug 21334: Add bibliographic content type definitions > > This patch adds the following content type definitions, to be used by > endpoint authors implementing MARC-related endpoints: > > -------------------------------------- > | Content-type | Alias | > |--------------------------|---------| > | application/marcxml+xml | marcxml | > | application/marc-in-json | mij | > | application/marc | marc | > -------------------------------------- > > Code using this aliases will use them like this: > - Suppose you want to output data in MARCXML format: > > my $record = cool_method_that_returns_MARC_RECORD(); > return $c->render( status => 200, format => 'marcxml', text => > $record->as_xml_record ); > > Note: 'text' by defaults encodes output as UTF-8. If the encoding is not > UTF-8 you should encode the data on your own. > > To test: > - Apply this patches > - Run: > $ kshell > k$ prove t/db_dependent/Koha/REST/V1.t > => SUCCESS: Test pass! > - Sign off :-D > > Signed-off-by: Michal Denar <https://whatstatus.co/guess-ill-die> > > Signed-off-by: Josef Moravec <josef.moravec@gmail.com> After pushing bug 21116 I decided this one warranted backporting for the same reasons outlined on that bug. |