[Bug 16699] New: Swagger: Split parameters and paths, and specify required permissions for resource
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16699 Bug ID: 16699 Summary: Swagger: Split parameters and paths, and specify required permissions for resource 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: larit@student.uef.fi QA Contact: testopia@bugs.koha-community.org It's great that Bug 15126 splits Swagger specification over multiple files. However, the problem of still exists as swagger.json grows larger with each new path. We should do the same split as Bug 15126 did, but for paths and parameters. I propose the following structure for paths: . ├── swagger.json ├── definitions │ └── index.json │ └── error.json │ └── patron.json ├── parameters │ └── index.json │ └── patron.json └── paths ├── index.json └── patrons.json Also Swagger should specify the required permissions for each resource. We can do this by adding "x-koha-permission"-field for each path, and using this field when checking for the needed permissions. This way required permissions are well-documented and anyone can instantly find out which permissions they need. -- 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=16699 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |15126 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15126 [Bug 15126] REST API: Use newer version of Swagger2 -- 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=16699 Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |benjamin.rokseth@kul.oslo.k | |ommune.no --- Comment #1 from Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> --- (In reply to Lari Taskula from comment #0)
It's great that Bug 15126 splits Swagger specification over multiple files. However, the problem of still exists as swagger.json grows larger with each new path. We should do the same split as Bug 15126 did, but for paths and parameters. I propose the following structure for paths:
. ├── swagger.json ├── definitions │ └── index.json │ └── error.json │ └── patron.json ├── parameters │ └── index.json │ └── patron.json └── paths ├── index.json └── patrons.json
Also Swagger should specify the required permissions for each resource. We can do this by adding "x-koha-permission"-field for each path, and using this field when checking for the needed permissions. This way required permissions are well-documented and anyone can instantly find out which permissions they need.
Agree with this one, patching swagger.json for each api update/enhancement is cumbersome and prone for errors. As it seems you have already implemented this, please submit patch and I will review asap. -- 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=16699 --- Comment #2 from Lari Taskula <larit@student.uef.fi> --- Thanks for the interest! Unfortunately, I am having some issues with this approach. The specifications won't validate through Swagger-UI validator (online.swagger.io/validator/debug?url=url_to_your_swagger.json). I read a little about the issue, and to my understanding the structure I described above does not seem to meet Swagger2 specification. It seems that the Paths Object does not take a $ref, but Path Item Object, which can take a $ref. This means that we would not meet the Swagger2 specification if we attempted something like this in swagger.json: .. "paths": { "$ref": "paths/index.json" }, .. In fact the same error happens when running the current master version (the definitions/index.json in Bug 15126) against online.swagger.io-validator. This is the error message I get with the online.swagger.io-validator: {"messages":["attribute definitions.$ref is not of type `object`"],"schemaValidationMessages":[{"level":"error","domain":"validation","keyword":"type","message":"instance type (string) does not match any allowed primitive type (allowed: [\"object\"])","schema":{"loadingURI":"http://swagger.io/v2/schema.json#","pointer":"/definitions/schema"},"instance":{"pointer":"/definitions/$ref"}}]} An option would be to keep the proposed structure for development, and use the minifySwagger.pl-script (Bug 16212) to have a valid Swagger specification in the minified swagger.min.json. -- 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=16699 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |16212 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 [Bug 16212] Swagger specification separation and minification -- 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=16699 --- Comment #3 from Lari Taskula <larit@student.uef.fi> --- Created attachment 52375 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52375&action=edit Bug 16699: Split parameters and paths in Swagger Parameters and paths should be split in our Swagger specification, because otherwise swagger.json would become messy with all the paths and their further specification in the same file. Also parameters should be split for the same reason. Instead of using index.json for definitions, parameters and paths, we define new files "definitions.json", "parameters.json" and "paths.json" in order to simplify the references. If we kept using index.json and try to reference "/definitions/error.json" from "/paths/holds.json", reference would be "../definitions/index.json#/error" instead of now simplified version, "../definitions.json#/error". Here is the proposed structure: . ├── swagger.json ├── definitions.json ├── paths.json ├── parameters.json ├── definitions │ └── error.json │ └── patron.json ├── parameters │ └── patron.json ├── paths │ └── patrons.json ├── minifySwagger.pl └── swagger.min.js The swagger.json paths, definitions and parameters will look as follows: ... "paths": { "$ref": "paths.json" }, "definitions": { "$ref": "definitions.json" }, "parameters": { "$ref": "parameters.json" } ... A problem with splitting specification into multiple files directly from swagger.json (e.g. "paths": { "$ref": "paths.json" }) is that it is not following the Swagger specification and an error will be thrown by the Swagger-UI default validator (online.swagger.io/validator). To overcome this problem, we use the minifySwagger.pl script from Bug 16212. This allows the developers to work with the structure introduced in this patch thus allowing developers to split the specification nicely, and still have a valid Swagger specification in the minified swagger.min.json. To test: -2: Apply the minifier-patch in Bug 16212. -1: Make sure you can validate your specification with Swagger2 validator at online.swagger.io/validator/debug?url=url_to_swaggerjson, or install it locally from https://github.com/swagger-api/validator-badge. 1. Don't apply this patch yet, but first validate swagger.json with swagger.io-validator (or your local version, if you installed it) 2. Observe that validation errors are given 3. Run minifySwagger.pl 4. Validate swagger.min.json with the validator you used in step 1 5. Observe that validation passes and we overcame the invalid specification problem in swagger.min.json 6. Apply this patch 7. Run minifySwagger.pl 8. Repeat step 4 9. Observe that validation passes with new structure 10. Run REST tests at t/db_dependents/api/v1 (11. Study the new structure of our Swagger specifications :)) -- 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=16699 --- Comment #4 from Lari Taskula <larit@student.uef.fi> --- Created attachment 52376 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52376&action=edit Bug 16699: Add borrowernumberQueryParam for reusability The borrowernumber as a query parameter should be defined in parameters.json in order to allow its reusability. To test: 1. Apply patch 2. Run minifySwagger.pl 3. Validate swagger.min.json in online.swagger.io/validator/debug?url=url_to+ _your_swagger_min_json or your local swagger-api/validator-badge validator 4. Observe that validation passes -- 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=16699 --- Comment #5 from Lari Taskula <larit@student.uef.fi> --- Created attachment 52377 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52377&action=edit Bug 16699: Fix mixed-up indentation from 2-4 spaces to 2 spaces These definitions had indentation of 4 spaces, while rest of the specification uses 2 spaces. This patch simply maintains the consistency in indentations and provides no other modifications to code. -- 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=16699 --- Comment #6 from Lari Taskula <larit@student.uef.fi> --- Created attachment 52378 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52378&action=edit Bug 16699: Support multiple types in primitive definitions Currently it is not possible to define multiple types for primitive definitions in /definitions/*. If you try to use the following "firstname": { "type": ["string", "null"], "description": "patron's first name" } in definitions.json, online.swagger.io validator will not validate it: {"messages":["attribute definitions.firstname.type is not of type `string`"]} One way to get around this issue is to extend definitions with custom "x-primitives" object, where we will define all reusable primitive definitions. To test: 1. Add the "firstname" example above to definitions.json 2. Run minifySwagger.pl 3. Validate your specification 4. Observe that error with description mentioned above is given 5. Apply patch 6. Repeat step 2 and 3 7. Observe that validation passes -- 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=16699 --- Comment #7 from Lari Taskula <larit@student.uef.fi> --- Created attachment 52379 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52379&action=edit Bug 16699: Reference new x-primitives in currently defined objects Since we have defined some basic x-primitives in x-primitives.json, we can now start to reuse them in our currently defined objects. To test: 1. Apply patch 2. Run minifySwagger.pl 3. Validate your Swagger specifications 4. Observe that validation passes -- 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=16699 --- Comment #8 from Lari Taskula <larit@student.uef.fi> --- Created attachment 52380 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52380&action=edit Bug 16699: Move Swagger-related files to api/v1/swagger This patch separates Swagger-specifications and the minifySwagger.pl from other api-files by moving specifications & minifier into api/v1/swagger. -- 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=16699 --- Comment #9 from Lari Taskula <larit@student.uef.fi> --- The patches above with Bug 16212 is my proposal for splitting the Swagger spec. This passes online.swagger.io/validator validations and passes all current REST tests in master. I think it is essential to split the specification yet also maintain its validity against the swagger.io-validator. I'm open to ideas and criticism :) I will soon provide the patch for defining the required permissions in Swagger paths spec. -- 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=16699 --- Comment #10 from Lari Taskula <larit@student.uef.fi> --- The second part of this Bug duplicated Bug 14868. Moving the permission definitions in Swagger spec to Bug 14868. -- 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=16699 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- 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=16699 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |14868 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14868 [Bug 14868] REST API: Swagger2-driven permission checking -- 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=16699 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52380|0 |1 is obsolete| | --- Comment #11 from Lari Taskula <larit@student.uef.fi> --- Created attachment 52580 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52580&action=edit Bug 16699: Move Swagger-related files to api/v1/swagger This patch separates Swagger-specifications and the minifySwagger.pl from other api-files by moving specifications & minifier into api/v1/swagger. -- 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=16699 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52580|0 |1 is obsolete| | --- Comment #12 from Lari Taskula <larit@student.uef.fi> --- Created attachment 52581 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52581&action=edit Bug 16699: Move Swagger-related files to api/v1/swagger This patch separates Swagger-specifications and the minifySwagger.pl from other api-files by moving specifications & minifier into api/v1/swagger. -- 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=16699 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52375|0 |1 is obsolete| | --- Comment #13 from Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> --- Created attachment 52956 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52956&action=edit Bug 16699: Split parameters and paths in Swagger Parameters and paths should be split in our Swagger specification, because otherwise swagger.json would become messy with all the paths and their further specification in the same file. Also parameters should be split for the same reason. Instead of using index.json for definitions, parameters and paths, we define new files "definitions.json", "parameters.json" and "paths.json" in order to simplify the references. If we kept using index.json and try to reference "/definitions/error.json" from "/paths/holds.json", reference would be "../definitions/index.json#/error" instead of now simplified version, "../definitions.json#/error". Here is the proposed structure: . ├── swagger.json ├── definitions.json ├── paths.json ├── parameters.json ├── definitions │ └── error.json │ └── patron.json ├── parameters │ └── patron.json ├── paths │ └── patrons.json ├── minifySwagger.pl └── swagger.min.js The swagger.json paths, definitions and parameters will look as follows: ... "paths": { "$ref": "paths.json" }, "definitions": { "$ref": "definitions.json" }, "parameters": { "$ref": "parameters.json" } ... A problem with splitting specification into multiple files directly from swagger.json (e.g. "paths": { "$ref": "paths.json" }) is that it is not following the Swagger specification and an error will be thrown by the Swagger-UI default validator (online.swagger.io/validator). To overcome this problem, we use the minifySwagger.pl script from Buug 16212. This allows the developers to work with the structure introduced in this patch thus allowing developers to split the specification nicely, and still have a valid Swagger specification in the minified swagger.min.json. To test: -2: Apply the minifier-patch in Buug 16212. -1: Make sure you can validate your specification with Swagger2 validator at online.swagger.io/validator/debug?url=url_to_swaggerjson, or install it locally from https://github.com/swagger-api/validator-badge. 1. Don't apply this patch yet, but first validate swagger.json with swagger.io-validator (or your local version, if you installed it) 2. Observe that validation errors are given 3. Run minifySwagger.pl 4. Validate swagger.min.json with the validator you used in step 1 5. Observe that validation passes and we overcame the invalid specification problem in swagger.min.json 6. Apply this patch 7. Run minifySwagger.pl 8. Repeat step 4 9. Observe that validation passes with new structure 10. Run REST tests at t/db_dependents/api/v1 (11. Study the new structure of our Swagger specifications :)) Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> My name is Olli-Antti Kivilahti and I approve this commit. We have been using the Swagger2.0-driven REST API on Mojolicious for 1 year now in production and I am certain we have a pretty good idea on how to work with the limitations of Swagger2.0 We participated in the development of the Mojolicious::Plugin::Swagger and know it well. We have made an extension to the plugin to provide full CORS support and have been building all our in-house features on the new REST API. -- 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=16699 --- Comment #14 from Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> --- Created attachment 52957 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52957&action=edit [SIGNED-OFF] Bug 16699: Split parameters and paths in Swagger Parameters and paths should be split in our Swagger specification, because otherwise swagger.json would become messy with all the paths and their further specification in the same file. Also parameters should be split for the same reason. Instead of using index.json for definitions, parameters and paths, we define new files "definitions.json", "parameters.json" and "paths.json" in order to simplify the references. If we kept using index.json and try to reference "/definitions/error.json" from "/paths/holds.json", reference would be "../definitions/index.json#/error" instead of now simplified version, "../definitions.json#/error". Here is the proposed structure: . ├── swagger.json ├── definitions.json ├── paths.json ├── parameters.json ├── definitions │ └── error.json │ └── patron.json ├── parameters │ └── patron.json ├── paths │ └── patrons.json ├── minifySwagger.pl └── swagger.min.js The swagger.json paths, definitions and parameters will look as follows: ... "paths": { "$ref": "paths.json" }, "definitions": { "$ref": "definitions.json" }, "parameters": { "$ref": "parameters.json" } ... A problem with splitting specification into multiple files directly from swagger.json (e.g. "paths": { "$ref": "paths.json" }) is that it is not following the Swagger specification and an error will be thrown by the Swagger-UI default validator (online.swagger.io/validator). To overcome this problem, we use the minifySwagger.pl script from Buug 16212. This allows the developers to work with the structure introduced in this patch thus allowing developers to split the specification nicely, and still have a valid Swagger specification in the minified swagger.min.json. To test: -2: Apply the minifier-patch in Buug 16212. -1: Make sure you can validate your specification with Swagger2 validator at online.swagger.io/validator/debug?url=url_to_swaggerjson, or install it locally from https://github.com/swagger-api/validator-badge. 1. Don't apply this patch yet, but first validate swagger.json with swagger.io-validator (or your local version, if you installed it) 2. Observe that validation errors are given 3. Run minifySwagger.pl 4. Validate swagger.min.json with the validator you used in step 1 5. Observe that validation passes and we overcame the invalid specification problem in swagger.min.json 6. Apply this patch 7. Run minifySwagger.pl 8. Repeat step 4 9. Observe that validation passes with new structure 10. Run REST tests at t/db_dependents/api/v1 (11. Study the new structure of our Swagger specifications :)) Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> My name is Olli-Antti Kivilahti and I approve this commit. We have been using the Swagger2.0-driven REST API on Mojolicious for 1 year now in production and I am certain we have a pretty good idea on how to work with the limitations of Swagger2.0 We participated in the development of the Mojolicious::Plugin::Swagger and know it well. We have made an extension to the plugin to provide full CORS support and have been building all our in-house features on the new REST API. -- 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=16699 --- Comment #15 from Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> --- Created attachment 52958 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52958&action=edit [SIGNED-OFF] Bug 16699: Add borrowernumberQueryParam for reusability The borrowernumber as a query parameter should be defined in parameters.json in order to allow its reusability. To test: 1. Apply patch 2. Run minifySwagger.pl 3. Validate swagger.min.json in online.swagger.io/validator/debug?url=url_to+ _your_swagger_min_json or your local swagger-api/validator-badge validator 4. Observe that validation passes Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> My name is Olli-Antti Kivilahti and I approve this commit. We have been using the Swagger2.0-driven REST API on Mojolicious for 1 year now in production and I am certain we have a pretty good idea on how to work with the limitations of Swagger2.0 We participated in the development of the Mojolicious::Plugin::Swagger and know it well. We have made an extension to the plugin to provide full CORS support and have been building all our in-house features on the new REST API. -- 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=16699 --- Comment #16 from Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> --- Created attachment 52959 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52959&action=edit [SIGNED-OFF] Bug 16699: Fix mixed-up indentation from 2-4 spaces to 2 spaces These definitions had indentation of 4 spaces, while rest of the specification uses 2 spaces. This patch simply maintains the consistency in indentations and provides no other modifications to code. Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> My name is Olli-Antti Kivilahti and I approve this commit. We have been using the Swagger2.0-driven REST API on Mojolicious for 1 year now in production and I am certain we have a pretty good idea on how to work with the limitations of Swagger2.0 We participated in the development of the Mojolicious::Plugin::Swagger and know it well. We have made an extension to the plugin to provide full CORS support and have been building all our in-house features on the new REST API. -- 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=16699 --- Comment #17 from Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> --- Created attachment 52960 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52960&action=edit [SIGNED-OFF] Bug 16699: Support multiple types in primitive definitions Currently it is not possible to define multiple types for primitive definitions in /definitions/*. If you try to use the following "firstname": { "type": ["string", "null"], "description": "patron's first name" } in definitions.json, online.swagger.io validator will not validate it: {"messages":["attribute definitions.firstname.type is not of type `string`"]} One way to get around this issue is to extend definitions with custom "x-primitives" object, where we will define all reusable primitive definitions. To test: 1. Add the "firstname" example above to definitions.json 2. Run minifySwagger.pl 3. Validate your specification 4. Observe that error with description mentioned above is given 5. Apply patch 6. Repeat step 2 and 3 7. Observe that validation passes Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> My name is Olli-Antti Kivilahti and I approve this commit. We have been using the Swagger2.0-driven REST API on Mojolicious for 1 year now in production and I am certain we have a pretty good idea on how to work with the limitations of Swagger2.0 We participated in the development of the Mojolicious::Plugin::Swagger and know it well. We have made an extension to the plugin to provide full CORS support and have been building all our in-house features on the new REST API. -- 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=16699 --- Comment #18 from Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> --- Created attachment 52961 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52961&action=edit [SIGNED-OFF] Bug 16699: Reference new x-primitives in currently defined objects Since we have defined some basic x-primitives in x-primitives.json, we can now start to reuse them in our currently defined objects. To test: 1. Apply patch 2. Run minifySwagger.pl 3. Validate your Swagger specifications 4. Observe that validation passes Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> My name is Olli-Antti Kivilahti and I approve this commit. We have been using the Swagger2.0-driven REST API on Mojolicious for 1 year now in production and I am certain we have a pretty good idea on how to work with the limitations of Swagger2.0 We participated in the development of the Mojolicious::Plugin::Swagger and know it well. We have made an extension to the plugin to provide full CORS support and have been building all our in-house features on the new REST API. -- 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=16699 --- Comment #19 from Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> --- Created attachment 52962 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52962&action=edit [SIGNED-OFF] Bug 16699: Move Swagger-related files to api/v1/swagger This patch separates Swagger-specifications and the minifySwagger.pl from other api-files by moving specifications & minifier into api/v1/swagger. Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> My name is Olli-Antti Kivilahti and I approve this commit. We have been using the Swagger2.0-driven REST API on Mojolicious for 1 year now in production and I am certain we have a pretty good idea on how to work with the limitations of Swagger2.0 We participated in the development of the Mojolicious::Plugin::Swagger and know it well. We have made an extension to the plugin to provide full CORS support and have been building all our in-house features on the new REST API. -- 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=16699 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |olli-antti.kivilahti@jns.fi Attachment #52378|0 |1 is obsolete| | -- 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=16699 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52379|0 |1 is obsolete| | -- 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=16699 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52581|0 |1 is obsolete| | -- 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=16699 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52956|0 |1 is obsolete| | -- 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=16699 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52376|0 |1 is obsolete| | -- 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=16699 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52377|0 |1 is obsolete| | -- 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=16699 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- 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=16699 Johanna Räisä <johanna.raisa@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52957|0 |1 is obsolete| | --- Comment #20 from Johanna Räisä <johanna.raisa@gmail.com> --- Created attachment 52974 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52974&action=edit [SIGNED-OFF] Bug 16699: Split parameters and paths in Swagger Parameters and paths should be split in our Swagger specification, because otherwise swagger.json would become messy with all the paths and their further specification in the same file. Also parameters should be split for the same reason. Instead of using index.json for definitions, parameters and paths, we define new files "definitions.json", "parameters.json" and "paths.json" in order to simplify the references. If we kept using index.json and try to reference "/definitions/error.json" from "/paths/holds.json", reference would be "../definitions/index.json#/error" instead of now simplified version, "../definitions.json#/error". Here is the proposed structure: . ├── swagger.json ├── definitions.json ├── paths.json ├── parameters.json ├── definitions │ └── error.json │ └── patron.json ├── parameters │ └── patron.json ├── paths │ └── patrons.json ├── minifySwagger.pl └── swagger.min.js The swagger.json paths, definitions and parameters will look as follows: ... "paths": { "$ref": "paths.json" }, "definitions": { "$ref": "definitions.json" }, "parameters": { "$ref": "parameters.json" } ... A problem with splitting specification into multiple files directly from swagger.json (e.g. "paths": { "$ref": "paths.json" }) is that it is not following the Swagger specification and an error will be thrown by the Swagger-UI default validator (online.swagger.io/validator). To overcome this problem, we use the minifySwagger.pl script from Buug 16212. This allows the developers to work with the structure introduced in this patch thus allowing developers to split the specification nicely, and still have a valid Swagger specification in the minified swagger.min.json. To test: -2: Apply the minifier-patch in Buug 16212. -1: Make sure you can validate your specification with Swagger2 validator at online.swagger.io/validator/debug?url=url_to_swaggerjson, or install it locally from https://github.com/swagger-api/validator-badge. 1. Don't apply this patch yet, but first validate swagger.json with swagger.io-validator (or your local version, if you installed it) 2. Observe that validation errors are given 3. Run minifySwagger.pl 4. Validate swagger.min.json with the validator you used in step 1 5. Observe that validation passes and we overcame the invalid specification problem in swagger.min.json 6. Apply this patch 7. Run minifySwagger.pl 8. Repeat step 4 9. Observe that validation passes with new structure 10. Run REST tests at t/db_dependents/api/v1 (11. Study the new structure of our Swagger specifications :)) Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> My name is Olli-Antti Kivilahti and I approve this commit. We have been using the Swagger2.0-driven REST API on Mojolicious for 1 year now in production and I am certain we have a pretty good idea on how to work with the limitations of Swagger2.0 We participated in the development of the Mojolicious::Plugin::Swagger and know it well. We have made an extension to the plugin to provide full CORS support and have been building all our in-house features on the new REST API. Signed-off-by: Johanna Raisa <johanna.raisa@gmail.com> My name is Johanna Räisä and I approve this commit. We have been using Swagger2.0-driven REST API in production successfully. -- 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=16699 Johanna Räisä <johanna.raisa@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52958|0 |1 is obsolete| | --- Comment #21 from Johanna Räisä <johanna.raisa@gmail.com> --- Created attachment 52975 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52975&action=edit [SIGNED-OFF] Bug 16699: Add borrowernumberQueryParam for reusability The borrowernumber as a query parameter should be defined in parameters.json in order to allow its reusability. To test: 1. Apply patch 2. Run minifySwagger.pl 3. Validate swagger.min.json in online.swagger.io/validator/debug?url=url_to+ _your_swagger_min_json or your local swagger-api/validator-badge validator 4. Observe that validation passes Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> My name is Olli-Antti Kivilahti and I approve this commit. We have been using the Swagger2.0-driven REST API on Mojolicious for 1 year now in production and I am certain we have a pretty good idea on how to work with the limitations of Swagger2.0 We participated in the development of the Mojolicious::Plugin::Swagger and know it well. We have made an extension to the plugin to provide full CORS support and have been building all our in-house features on the new REST API. Signed-off-by: Johanna Raisa <johanna.raisa@gmail.com> My name is Johanna Räisä and I approve this commit. We have been using Swagger2.0-driven REST API in production successfully. -- 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=16699 Johanna Räisä <johanna.raisa@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52959|0 |1 is obsolete| | --- Comment #22 from Johanna Räisä <johanna.raisa@gmail.com> --- Created attachment 52976 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52976&action=edit [SIGNED-OFF] Bug 16699: Fix mixed-up indentation from 2-4 spaces to 2 spaces These definitions had indentation of 4 spaces, while rest of the specification uses 2 spaces. This patch simply maintains the consistency in indentations and provides no other modifications to code. Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> My name is Olli-Antti Kivilahti and I approve this commit. We have been using the Swagger2.0-driven REST API on Mojolicious for 1 year now in production and I am certain we have a pretty good idea on how to work with the limitations of Swagger2.0 We participated in the development of the Mojolicious::Plugin::Swagger and know it well. We have made an extension to the plugin to provide full CORS support and have been building all our in-house features on the new REST API. Signed-off-by: Johanna Raisa <johanna.raisa@gmail.com> My name is Johanna Räisä and I approve this commit. We have been using Swagger2.0-driven REST API in production successfully. -- 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=16699 Johanna Räisä <johanna.raisa@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52960|0 |1 is obsolete| | --- Comment #23 from Johanna Räisä <johanna.raisa@gmail.com> --- Created attachment 52978 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52978&action=edit [SIGNED-OFF] Bug 16699: Support multiple types in primitive definitions Currently it is not possible to define multiple types for primitive definitions in /definitions/*. If you try to use the following "firstname": { "type": ["string", "null"], "description": "patron's first name" } in definitions.json, online.swagger.io validator will not validate it: {"messages":["attribute definitions.firstname.type is not of type `string`"]} One way to get around this issue is to extend definitions with custom "x-primitives" object, where we will define all reusable primitive definitions. To test: 1. Add the "firstname" example above to definitions.json 2. Run minifySwagger.pl 3. Validate your specification 4. Observe that error with description mentioned above is given 5. Apply patch 6. Repeat step 2 and 3 7. Observe that validation passes Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> My name is Olli-Antti Kivilahti and I approve this commit. We have been using the Swagger2.0-driven REST API on Mojolicious for 1 year now in production and I am certain we have a pretty good idea on how to work with the limitations of Swagger2.0 We participated in the development of the Mojolicious::Plugin::Swagger and know it well. We have made an extension to the plugin to provide full CORS support and have been building all our in-house features on the new REST API. Signed-off-by: Johanna Raisa <johanna.raisa@gmail.com> My name is Johanna Räisä and I approve this commit. We have been using Swagger2.0-driven REST API in production successfully. -- 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=16699 Johanna Räisä <johanna.raisa@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52961|0 |1 is obsolete| | --- Comment #24 from Johanna Räisä <johanna.raisa@gmail.com> --- Created attachment 52979 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52979&action=edit [SIGNED-OFF] Bug 16699: Reference new x-primitives in currently defined objects Since we have defined some basic x-primitives in x-primitives.json, we can now start to reuse them in our currently defined objects. To test: 1. Apply patch 2. Run minifySwagger.pl 3. Validate your Swagger specifications 4. Observe that validation passes Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> My name is Olli-Antti Kivilahti and I approve this commit. We have been using the Swagger2.0-driven REST API on Mojolicious for 1 year now in production and I am certain we have a pretty good idea on how to work with the limitations of Swagger2.0 We participated in the development of the Mojolicious::Plugin::Swagger and know it well. We have made an extension to the plugin to provide full CORS support and have been building all our in-house features on the new REST API. Signed-off-by: Johanna Raisa <johanna.raisa@gmail.com> My name is Johanna Räisä and I approve this commit. We have been using Swagger2.0-driven REST API in production successfully. -- 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=16699 Johanna Räisä <johanna.raisa@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52962|0 |1 is obsolete| | --- Comment #25 from Johanna Räisä <johanna.raisa@gmail.com> --- Created attachment 52980 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52980&action=edit [SIGNED-OFF] Bug 16699: Move Swagger-related files to api/v1/swagger This patch separates Swagger-specifications and the minifySwagger.pl from other api-files by moving specifications & minifier into api/v1/swagger. Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> My name is Olli-Antti Kivilahti and I approve this commit. We have been using the Swagger2.0-driven REST API on Mojolicious for 1 year now in production and I am certain we have a pretty good idea on how to work with the limitations of Swagger2.0 We participated in the development of the Mojolicious::Plugin::Swagger and know it well. We have made an extension to the plugin to provide full CORS support and have been building all our in-house features on the new REST API. Signed-off-by: Johanna Raisa <johanna.raisa@gmail.com> My name is Johanna Räisä and I approve this commit. We have been using Swagger2.0-driven REST API in production successfully. -- 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=16699 Johanna Räisä <johanna.raisa@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52974|0 |1 is obsolete| | --- Comment #26 from Johanna Räisä <johanna.raisa@gmail.com> --- Created attachment 52986 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52986&action=edit [SIGNED-OFF] Bug 16699: Split parameters and paths in Swagger Parameters and paths should be split in our Swagger specification, because otherwise swagger.json would become messy with all the paths and their further specification in the same file. Also parameters should be split for the same reason. Instead of using index.json for definitions, parameters and paths, we define new files "definitions.json", "parameters.json" and "paths.json" in order to simplify the references. If we kept using index.json and try to reference "/definitions/error.json" from "/paths/holds.json", reference would be "../definitions/index.json#/error" instead of now simplified version, "../definitions.json#/error". Here is the proposed structure: . ├── swagger.json ├── definitions.json ├── paths.json ├── parameters.json ├── definitions │ └── error.json │ └── patron.json ├── parameters │ └── patron.json ├── paths │ └── patrons.json ├── minifySwagger.pl └── swagger.min.js The swagger.json paths, definitions and parameters will look as follows: ... "paths": { "$ref": "paths.json" }, "definitions": { "$ref": "definitions.json" }, "parameters": { "$ref": "parameters.json" } ... A problem with splitting specification into multiple files directly from swagger.json (e.g. "paths": { "$ref": "paths.json" }) is that it is not following the Swagger specification and an error will be thrown by the Swagger-UI default validator (online.swagger.io/validator). To overcome this problem, we use the minifySwagger.pl script from Buug 16212. This allows the developers to work with the structure introduced in this patch thus allowing developers to split the specification nicely, and still have a valid Swagger specification in the minified swagger.min.json. To test: -2: Apply the minifier-patch in Buug 16212. -1: Make sure you can validate your specification with Swagger2 validator at online.swagger.io/validator/debug?url=url_to_swaggerjson, or install it locally from https://github.com/swagger-api/validator-badge. 1. Don't apply this patch yet, but first validate swagger.json with swagger.io-validator (or your local version, if you installed it) 2. Observe that validation errors are given 3. Run minifySwagger.pl 4. Validate swagger.min.json with the validator you used in step 1 5. Observe that validation passes and we overcame the invalid specification problem in swagger.min.json 6. Apply this patch 7. Run minifySwagger.pl 8. Repeat step 4 9. Observe that validation passes with new structure 10. Run REST tests at t/db_dependents/api/v1 (11. Study the new structure of our Swagger specifications :)) Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> My name is Olli-Antti Kivilahti and I approve this commit. We have been using the Swagger2.0-driven REST API on Mojolicious for 1 year now in production and I am certain we have a pretty good idea on how to work with the limitations of Swagger2.0 We participated in the development of the Mojolicious::Plugin::Swagger and know it well. We have made an extension to the plugin to provide full CORS support and have been building all our in-house features on the new REST API. Signed-off-by: Johanna Raisa <johanna.raisa@gmail.com> My name is Johanna Räisä and I approve this commit. We have been using Swagger2.0-driven REST API in production successfully. -- 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=16699 Johanna Räisä <johanna.raisa@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52975|0 |1 is obsolete| | --- Comment #27 from Johanna Räisä <johanna.raisa@gmail.com> --- Created attachment 52987 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52987&action=edit [SIGNED-OFF] Bug 16699: Add borrowernumberQueryParam for reusability The borrowernumber as a query parameter should be defined in parameters.json in order to allow its reusability. To test: 1. Apply patch 2. Run minifySwagger.pl 3. Validate swagger.min.json in online.swagger.io/validator/debug?url=url_to+ _your_swagger_min_json or your local swagger-api/validator-badge validator 4. Observe that validation passes Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> My name is Olli-Antti Kivilahti and I approve this commit. We have been using the Swagger2.0-driven REST API on Mojolicious for 1 year now in production and I am certain we have a pretty good idea on how to work with the limitations of Swagger2.0 We participated in the development of the Mojolicious::Plugin::Swagger and know it well. We have made an extension to the plugin to provide full CORS support and have been building all our in-house features on the new REST API. Signed-off-by: Johanna Raisa <johanna.raisa@gmail.com> My name is Johanna Räisä and I approve this commit. We have been using Swagger2.0-driven REST API in production successfully. -- 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=16699 Johanna Räisä <johanna.raisa@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52976|0 |1 is obsolete| | --- Comment #28 from Johanna Räisä <johanna.raisa@gmail.com> --- Created attachment 52988 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52988&action=edit [SIGNED-OFF] Bug 16699: Fix mixed-up indentation from 2-4 spaces to 2 spaces These definitions had indentation of 4 spaces, while rest of the specification uses 2 spaces. This patch simply maintains the consistency in indentations and provides no other modifications to code. Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> My name is Olli-Antti Kivilahti and I approve this commit. We have been using the Swagger2.0-driven REST API on Mojolicious for 1 year now in production and I am certain we have a pretty good idea on how to work with the limitations of Swagger2.0 We participated in the development of the Mojolicious::Plugin::Swagger and know it well. We have made an extension to the plugin to provide full CORS support and have been building all our in-house features on the new REST API. Signed-off-by: Johanna Raisa <johanna.raisa@gmail.com> My name is Johanna Räisä and I approve this commit. We have been using Swagger2.0-driven REST API in production successfully. -- 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=16699 Johanna Räisä <johanna.raisa@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52978|0 |1 is obsolete| | --- Comment #29 from Johanna Räisä <johanna.raisa@gmail.com> --- Created attachment 52989 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52989&action=edit [SIGNED-OFF] Bug 16699: Support multiple types in primitive definitions Currently it is not possible to define multiple types for primitive definitions in /definitions/*. If you try to use the following "firstname": { "type": ["string", "null"], "description": "patron's first name" } in definitions.json, online.swagger.io validator will not validate it: {"messages":["attribute definitions.firstname.type is not of type `string`"]} One way to get around this issue is to extend definitions with custom "x-primitives" object, where we will define all reusable primitive definitions. To test: 1. Add the "firstname" example above to definitions.json 2. Run minifySwagger.pl 3. Validate your specification 4. Observe that error with description mentioned above is given 5. Apply patch 6. Repeat step 2 and 3 7. Observe that validation passes Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> My name is Olli-Antti Kivilahti and I approve this commit. We have been using the Swagger2.0-driven REST API on Mojolicious for 1 year now in production and I am certain we have a pretty good idea on how to work with the limitations of Swagger2.0 We participated in the development of the Mojolicious::Plugin::Swagger and know it well. We have made an extension to the plugin to provide full CORS support and have been building all our in-house features on the new REST API. Signed-off-by: Johanna Raisa <johanna.raisa@gmail.com> My name is Johanna Räisä and I approve this commit. We have been using Swagger2.0-driven REST API in production successfully. -- 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=16699 Johanna Räisä <johanna.raisa@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52979|0 |1 is obsolete| | --- Comment #30 from Johanna Räisä <johanna.raisa@gmail.com> --- Created attachment 52990 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52990&action=edit [SIGNED-OFF] Bug 16699: Reference new x-primitives in currently defined objects Since we have defined some basic x-primitives in x-primitives.json, we can now start to reuse them in our currently defined objects. To test: 1. Apply patch 2. Run minifySwagger.pl 3. Validate your Swagger specifications 4. Observe that validation passes Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> My name is Olli-Antti Kivilahti and I approve this commit. We have been using the Swagger2.0-driven REST API on Mojolicious for 1 year now in production and I am certain we have a pretty good idea on how to work with the limitations of Swagger2.0 We participated in the development of the Mojolicious::Plugin::Swagger and know it well. We have made an extension to the plugin to provide full CORS support and have been building all our in-house features on the new REST API. Signed-off-by: Johanna Raisa <johanna.raisa@gmail.com> My name is Johanna Räisä and I approve this commit. We have been using Swagger2.0-driven REST API in production successfully. -- 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=16699 Johanna Räisä <johanna.raisa@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52980|0 |1 is obsolete| | --- Comment #31 from Johanna Räisä <johanna.raisa@gmail.com> --- Created attachment 52991 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=52991&action=edit [SIGNED-OFF] Bug 16699: Move Swagger-related files to api/v1/swagger This patch separates Swagger-specifications and the minifySwagger.pl from other api-files by moving specifications & minifier into api/v1/swagger. Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> My name is Olli-Antti Kivilahti and I approve this commit. We have been using the Swagger2.0-driven REST API on Mojolicious for 1 year now in production and I am certain we have a pretty good idea on how to work with the limitations of Swagger2.0 We participated in the development of the Mojolicious::Plugin::Swagger and know it well. We have made an extension to the plugin to provide full CORS support and have been building all our in-house features on the new REST API. Signed-off-by: Johanna Raisa <johanna.raisa@gmail.com> My name is Johanna Räisä and I approve this commit. We have been using Swagger2.0-driven REST API in production successfully. -- 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=16699 --- Comment #32 from Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> ---
Currently it is not possible to define multiple types for primitive definitions in /definitions/*. If you try to use the following "firstname": { "type": ["string", "null"], "description": "patron's first name"
mojo swagger2 validate accepts this, and it works, so what is the problem? Perhaps we should consider online swagger validator faulty? If you remove agree on my objections to bug 16212 and remove the auto minifying I would be happy to sign off. -- 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=16699 Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52986|0 |1 is obsolete| | --- Comment #33 from Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> --- Created attachment 54299 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=54299&action=edit [SIGNED-OFF] Bug 16699: Split parameters and paths in Swagger Parameters and paths should be split in our Swagger specification, because otherwise swagger.json would become messy with all the paths and their further specification in the same file. Also parameters should be split for the same reason. Instead of using index.json for definitions, parameters and paths, we define new files "definitions.json", "parameters.json" and "paths.json" in order to simplify the references. If we kept using index.json and try to reference "/definitions/error.json" from "/paths/holds.json", reference would be "../definitions/index.json#/error" instead of now simplified version, "../definitions.json#/error". Here is the proposed structure: . ├── swagger.json ├── definitions.json ├── paths.json ├── parameters.json ├── definitions │ └── error.json │ └── patron.json ├── parameters │ └── patron.json ├── paths │ └── patrons.json ├── minifySwagger.pl └── swagger.min.js The swagger.json paths, definitions and parameters will look as follows: ... "paths": { "$ref": "paths.json" }, "definitions": { "$ref": "definitions.json" }, "parameters": { "$ref": "parameters.json" } ... A problem with splitting specification into multiple files directly from swagger.json (e.g. "paths": { "$ref": "paths.json" }) is that it is not following the Swagger specification and an error will be thrown by the Swagger-UI default validator (online.swagger.io/validator). To overcome this problem, we use the minifySwagger.pl script from Buug 16212. This allows the developers to work with the structure introduced in this patch thus allowing developers to split the specification nicely, and still have a valid Swagger specification in the minified swagger.min.json. To test: -2: Apply the minifier-patch in Buug 16212. -1: Make sure you can validate your specification with Swagger2 validator at online.swagger.io/validator/debug?url=url_to_swaggerjson, or install it locally from https://github.com/swagger-api/validator-badge. 1. Don't apply this patch yet, but first validate swagger.json with swagger.io-validator (or your local version, if you installed it) 2. Observe that validation errors are given 3. Run minifySwagger.pl 4. Validate swagger.min.json with the validator you used in step 1 5. Observe that validation passes and we overcame the invalid specification problem in swagger.min.json 6. Apply this patch 7. Run minifySwagger.pl 8. Repeat step 4 9. Observe that validation passes with new structure 10. Run REST tests at t/db_dependents/api/v1 (11. Study the new structure of our Swagger specifications :)) Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> My name is Olli-Antti Kivilahti and I approve this commit. We have been using the Swagger2.0-driven REST API on Mojolicious for 1 year now in production and I am certain we have a pretty good idea on how to work with the limitations of Swagger2.0 We participated in the development of the Mojolicious::Plugin::Swagger and know it well. We have made an extension to the plugin to provide full CORS support and have been building all our in-house features on the new REST API. Signed-off-by: Johanna Raisa <johanna.raisa@gmail.com> My name is Johanna Räisä and I approve this commit. We have been using Swagger2.0-driven REST API in production successfully. Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> -- 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=16699 Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52987|0 |1 is obsolete| | --- Comment #34 from Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> --- Created attachment 54300 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=54300&action=edit [SIGNED-OFF] Bug 16699: Add borrowernumberQueryParam for reusability The borrowernumber as a query parameter should be defined in parameters.json in order to allow its reusability. To test: 1. Apply patch 2. Run minifySwagger.pl 3. Validate swagger.min.json in online.swagger.io/validator/debug?url=url_to+ _your_swagger_min_json or your local swagger-api/validator-badge validator 4. Observe that validation passes Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> My name is Olli-Antti Kivilahti and I approve this commit. We have been using the Swagger2.0-driven REST API on Mojolicious for 1 year now in production and I am certain we have a pretty good idea on how to work with the limitations of Swagger2.0 We participated in the development of the Mojolicious::Plugin::Swagger and know it well. We have made an extension to the plugin to provide full CORS support and have been building all our in-house features on the new REST API. Signed-off-by: Johanna Raisa <johanna.raisa@gmail.com> My name is Johanna Räisä and I approve this commit. We have been using Swagger2.0-driven REST API in production successfully. Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> -- 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=16699 Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52988|0 |1 is obsolete| | --- Comment #35 from Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> --- Created attachment 54301 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=54301&action=edit [SIGNED-OFF] Bug 16699: Fix mixed-up indentation from 2-4 spaces to 2 spaces These definitions had indentation of 4 spaces, while rest of the specification uses 2 spaces. This patch simply maintains the consistency in indentations and provides no other modifications to code. Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> My name is Olli-Antti Kivilahti and I approve this commit. We have been using the Swagger2.0-driven REST API on Mojolicious for 1 year now in production and I am certain we have a pretty good idea on how to work with the limitations of Swagger2.0 We participated in the development of the Mojolicious::Plugin::Swagger and know it well. We have made an extension to the plugin to provide full CORS support and have been building all our in-house features on the new REST API. Signed-off-by: Johanna Raisa <johanna.raisa@gmail.com> My name is Johanna Räisä and I approve this commit. We have been using Swagger2.0-driven REST API in production successfully. Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> -- 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=16699 Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52989|0 |1 is obsolete| | --- Comment #36 from Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> --- Created attachment 54302 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=54302&action=edit [SIGNED-OFF] Bug 16699: Support multiple types in primitive definitions Currently it is not possible to define multiple types for primitive definitions in /definitions/*. If you try to use the following "firstname": { "type": ["string", "null"], "description": "patron's first name" } in definitions.json, online.swagger.io validator will not validate it: {"messages":["attribute definitions.firstname.type is not of type `string`"]} One way to get around this issue is to extend definitions with custom "x-primitives" object, where we will define all reusable primitive definitions. To test: 1. Add the "firstname" example above to definitions.json 2. Run minifySwagger.pl 3. Validate your specification 4. Observe that error with description mentioned above is given 5. Apply patch 6. Repeat step 2 and 3 7. Observe that validation passes Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> My name is Olli-Antti Kivilahti and I approve this commit. We have been using the Swagger2.0-driven REST API on Mojolicious for 1 year now in production and I am certain we have a pretty good idea on how to work with the limitations of Swagger2.0 We participated in the development of the Mojolicious::Plugin::Swagger and know it well. We have made an extension to the plugin to provide full CORS support and have been building all our in-house features on the new REST API. Signed-off-by: Johanna Raisa <johanna.raisa@gmail.com> My name is Johanna Räisä and I approve this commit. We have been using Swagger2.0-driven REST API in production successfully. Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> -- 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=16699 Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52990|0 |1 is obsolete| | --- Comment #37 from Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> --- Created attachment 54303 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=54303&action=edit [SIGNED-OFF] Bug 16699: Reference new x-primitives in currently defined objects Since we have defined some basic x-primitives in x-primitives.json, we can now start to reuse them in our currently defined objects. To test: 1. Apply patch 2. Run minifySwagger.pl 3. Validate your Swagger specifications 4. Observe that validation passes Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> My name is Olli-Antti Kivilahti and I approve this commit. We have been using the Swagger2.0-driven REST API on Mojolicious for 1 year now in production and I am certain we have a pretty good idea on how to work with the limitations of Swagger2.0 We participated in the development of the Mojolicious::Plugin::Swagger and know it well. We have made an extension to the plugin to provide full CORS support and have been building all our in-house features on the new REST API. Signed-off-by: Johanna Raisa <johanna.raisa@gmail.com> My name is Johanna Räisä and I approve this commit. We have been using Swagger2.0-driven REST API in production successfully. Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> -- 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=16699 Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #52991|0 |1 is obsolete| | --- Comment #38 from Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> --- Created attachment 54304 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=54304&action=edit [SIGNED-OFF] Bug 16699: Move Swagger-related files to api/v1/swagger This patch separates Swagger-specifications and the minifySwagger.pl from other api-files by moving specifications & minifier into api/v1/swagger. Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> My name is Olli-Antti Kivilahti and I approve this commit. We have been using the Swagger2.0-driven REST API on Mojolicious for 1 year now in production and I am certain we have a pretty good idea on how to work with the limitations of Swagger2.0 We participated in the development of the Mojolicious::Plugin::Swagger and know it well. We have made an extension to the plugin to provide full CORS support and have been building all our in-house features on the new REST API. Signed-off-by: Johanna Raisa <johanna.raisa@gmail.com> My name is Johanna Räisä and I approve this commit. We have been using Swagger2.0-driven REST API in production successfully. Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> -- 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=16699 --- Comment #39 from Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> --- Rebased against 16271 which is now in master. Removed patched t/api/v1/minifier.t which should be moved to bug #17102 Please test and get this moved further, as it is a pain to rebase swagger definitions as is today ... -- 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=16699 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Needs Signoff Depends on|15126, 16212 |16271 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=15126 [Bug 15126] REST API: Use newer version of Swagger2 https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 [Bug 16212] Swagger specification separation and minification https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16271 [Bug 16271] Allow more filters on /api/v1/holds -- 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=16699 --- Comment #40 from Lari Taskula <larit@student.uef.fi> --- Created attachment 54311 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=54311&action=edit Bug 16699: Remove requirement from borrowernumberQueryParam borrowernumberQueryParam shouldn't be required as also changed in Bug 16271. To test: 1. Don't apply the patch yet, but first minify Swagger and run t/db_dependent/api/v1/holds.t 2. Observe that some tests fail with response code 400 when expecting 200. 3. Apply patch and minify Swagger 4. Run t/db_dependent/api/v1/holds.t 5. Observe that tests pass. -- 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=16699 Lari Taskula <larit@student.uef.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |16212 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16212 [Bug 16212] Swagger specification separation and minification -- 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=16699 --- Comment #41 from Lari Taskula <larit@student.uef.fi> --- (In reply to Benjamin Rokseth from comment #39)
Rebased against 16271 which is now in master.
Removed patched t/api/v1/minifier.t which should be moved to bug #17102
Please test and get this moved further, as it is a pain to rebase swagger definitions as is today ... Thanks Benjamin! And I agree, it can be surprisingly time consuming!
-- 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=16699 Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #54311|0 |1 is obsolete| | --- Comment #42 from Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> --- Created attachment 54372 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=54372&action=edit Bug 16699: Remove requirement from borrowernumberQueryParam borrowernumberQueryParam shouldn't be required as also changed in Bug 16271. To test: 1. Don't apply the patch yet, but first minify Swagger and run t/db_dependent/api/v1/holds.t 2. Observe that some tests fail with response code 400 when expecting 200. 3. Apply patch and minify Swagger 4. Run t/db_dependent/api/v1/holds.t 5. Observe that tests pass. Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> -- 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=16699 Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #54372|Bug 16699: Remove |[SIGNED-OFF] Bug 16699: description|requirement from |Remove requirement from |borrowernumberQueryParam |borrowernumberQueryParam -- 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=16699 Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- 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=16699 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #54299|0 |1 is obsolete| | --- Comment #43 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 54884 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=54884&action=edit Bug 16699: Split parameters and paths in Swagger Parameters and paths should be split in our Swagger specification, because otherwise swagger.json would become messy with all the paths and their further specification in the same file. Also parameters should be split for the same reason. Instead of using index.json for definitions, parameters and paths, we define new files "definitions.json", "parameters.json" and "paths.json" in order to simplify the references. If we kept using index.json and try to reference "/definitions/error.json" from "/paths/holds.json", reference would be "../definitions/index.json#/error" instead of now simplified version, "../definitions.json#/error". Here is the proposed structure: . ├── swagger.json ├── definitions.json ├── paths.json ├── parameters.json ├── definitions │ └── error.json │ └── patron.json ├── parameters │ └── patron.json ├── paths │ └── patrons.json ├── minifySwagger.pl └── swagger.min.js The swagger.json paths, definitions and parameters will look as follows: ... "paths": { "$ref": "paths.json" }, "definitions": { "$ref": "definitions.json" }, "parameters": { "$ref": "parameters.json" } ... A problem with splitting specification into multiple files directly from swagger.json (e.g. "paths": { "$ref": "paths.json" }) is that it is not following the Swagger specification and an error will be thrown by the Swagger-UI default validator (online.swagger.io/validator). To overcome this problem, we use the minifySwagger.pl script from Buug 16212. This allows the developers to work with the structure introduced in this patch thus allowing developers to split the specification nicely, and still have a valid Swagger specification in the minified swagger.min.json. To test: -2: Apply the minifier-patch in Buug 16212. -1: Make sure you can validate your specification with Swagger2 validator at online.swagger.io/validator/debug?url=url_to_swaggerjson, or install it locally from https://github.com/swagger-api/validator-badge. 1. Don't apply this patch yet, but first validate swagger.json with swagger.io-validator (or your local version, if you installed it) 2. Observe that validation errors are given 3. Run minifySwagger.pl 4. Validate swagger.min.json with the validator you used in step 1 5. Observe that validation passes and we overcame the invalid specification problem in swagger.min.json 6. Apply this patch 7. Run minifySwagger.pl 8. Repeat step 4 9. Observe that validation passes with new structure 10. Run REST tests at t/db_dependents/api/v1 (11. Study the new structure of our Swagger specifications :)) Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> My name is Olli-Antti Kivilahti and I approve this commit. We have been using the Swagger2.0-driven REST API on Mojolicious for 1 year now in production and I am certain we have a pretty good idea on how to work with the limitations of Swagger2.0 We participated in the development of the Mojolicious::Plugin::Swagger and know it well. We have made an extension to the plugin to provide full CORS support and have been building all our in-house features on the new REST API. Signed-off-by: Johanna Raisa <johanna.raisa@gmail.com> My name is Johanna Räisä and I approve this commit. We have been using Swagger2.0-driven REST API in production successfully. Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- 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=16699 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #54300|0 |1 is obsolete| | --- Comment #44 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 54885 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=54885&action=edit Bug 16699: Add borrowernumberQueryParam for reusability The borrowernumber as a query parameter should be defined in parameters.json in order to allow its reusability. To test: 1. Apply patch 2. Run minifySwagger.pl 3. Validate swagger.min.json in online.swagger.io/validator/debug?url=url_to+ _your_swagger_min_json or your local swagger-api/validator-badge validator 4. Observe that validation passes Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> My name is Olli-Antti Kivilahti and I approve this commit. We have been using the Swagger2.0-driven REST API on Mojolicious for 1 year now in production and I am certain we have a pretty good idea on how to work with the limitations of Swagger2.0 We participated in the development of the Mojolicious::Plugin::Swagger and know it well. We have made an extension to the plugin to provide full CORS support and have been building all our in-house features on the new REST API. Signed-off-by: Johanna Raisa <johanna.raisa@gmail.com> My name is Johanna Räisä and I approve this commit. We have been using Swagger2.0-driven REST API in production successfully. Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- 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=16699 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #54301|0 |1 is obsolete| | --- Comment #45 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 54886 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=54886&action=edit Bug 16699: Fix mixed-up indentation from 2-4 spaces to 2 spaces These definitions had indentation of 4 spaces, while rest of the specification uses 2 spaces. This patch simply maintains the consistency in indentations and provides no other modifications to code. Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> My name is Olli-Antti Kivilahti and I approve this commit. We have been using the Swagger2.0-driven REST API on Mojolicious for 1 year now in production and I am certain we have a pretty good idea on how to work with the limitations of Swagger2.0 We participated in the development of the Mojolicious::Plugin::Swagger and know it well. We have made an extension to the plugin to provide full CORS support and have been building all our in-house features on the new REST API. Signed-off-by: Johanna Raisa <johanna.raisa@gmail.com> My name is Johanna Räisä and I approve this commit. We have been using Swagger2.0-driven REST API in production successfully. Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- 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=16699 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #54302|0 |1 is obsolete| | --- Comment #46 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 54887 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=54887&action=edit Bug 16699: Support multiple types in primitive definitions Currently it is not possible to define multiple types for primitive definitions in /definitions/*. If you try to use the following "firstname": { "type": ["string", "null"], "description": "patron's first name" } in definitions.json, online.swagger.io validator will not validate it: {"messages":["attribute definitions.firstname.type is not of type `string`"]} One way to get around this issue is to extend definitions with custom "x-primitives" object, where we will define all reusable primitive definitions. To test: 1. Add the "firstname" example above to definitions.json 2. Run minifySwagger.pl 3. Validate your specification 4. Observe that error with description mentioned above is given 5. Apply patch 6. Repeat step 2 and 3 7. Observe that validation passes Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> My name is Olli-Antti Kivilahti and I approve this commit. We have been using the Swagger2.0-driven REST API on Mojolicious for 1 year now in production and I am certain we have a pretty good idea on how to work with the limitations of Swagger2.0 We participated in the development of the Mojolicious::Plugin::Swagger and know it well. We have made an extension to the plugin to provide full CORS support and have been building all our in-house features on the new REST API. Signed-off-by: Johanna Raisa <johanna.raisa@gmail.com> My name is Johanna Räisä and I approve this commit. We have been using Swagger2.0-driven REST API in production successfully. Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- 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=16699 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #54303|0 |1 is obsolete| | --- Comment #47 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 54888 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=54888&action=edit Bug 16699: Reference new x-primitives in currently defined objects Since we have defined some basic x-primitives in x-primitives.json, we can now start to reuse them in our currently defined objects. To test: 1. Apply patch 2. Run minifySwagger.pl 3. Validate your Swagger specifications 4. Observe that validation passes Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> My name is Olli-Antti Kivilahti and I approve this commit. We have been using the Swagger2.0-driven REST API on Mojolicious for 1 year now in production and I am certain we have a pretty good idea on how to work with the limitations of Swagger2.0 We participated in the development of the Mojolicious::Plugin::Swagger and know it well. We have made an extension to the plugin to provide full CORS support and have been building all our in-house features on the new REST API. Signed-off-by: Johanna Raisa <johanna.raisa@gmail.com> My name is Johanna Räisä and I approve this commit. We have been using Swagger2.0-driven REST API in production successfully. Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- 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=16699 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #54304|0 |1 is obsolete| | --- Comment #48 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 54889 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=54889&action=edit Bug 16699: Move Swagger-related files to api/v1/swagger This patch separates Swagger-specifications and the minifySwagger.pl from other api-files by moving specifications & minifier into api/v1/swagger. Signed-off-by: Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> My name is Olli-Antti Kivilahti and I approve this commit. We have been using the Swagger2.0-driven REST API on Mojolicious for 1 year now in production and I am certain we have a pretty good idea on how to work with the limitations of Swagger2.0 We participated in the development of the Mojolicious::Plugin::Swagger and know it well. We have made an extension to the plugin to provide full CORS support and have been building all our in-house features on the new REST API. Signed-off-by: Johanna Raisa <johanna.raisa@gmail.com> My name is Johanna Räisä and I approve this commit. We have been using Swagger2.0-driven REST API in production successfully. Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- 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=16699 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #54372|0 |1 is obsolete| | --- Comment #49 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 54890 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=54890&action=edit Bug 16699: Remove requirement from borrowernumberQueryParam borrowernumberQueryParam shouldn't be required as also changed in Bug 16271. To test: 1. Don't apply the patch yet, but first minify Swagger and run t/db_dependent/api/v1/holds.t 2. Observe that some tests fail with response code 400 when expecting 200. 3. Apply patch and minify Swagger 4. Run t/db_dependent/api/v1/holds.t 5. Observe that tests pass. Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- 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=16699 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- 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=16699 --- Comment #50 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 54891 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=54891&action=edit Bug 16699: (QA followup) Move minified swagger file into the swagger/ dir Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- 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=16699 Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #54891|0 |1 is obsolete| | --- Comment #51 from Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> --- Created attachment 54892 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=54892&action=edit Bug 16699: (QA followup) Move minified swagger file into the swagger/ dir Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> -- 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=16699 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kyle@bywatersolutions.com Status|Passed QA |Pushed to Master --- Comment #52 from Kyle M Hall <kyle@bywatersolutions.com> --- Pushed to master for 16.11, thanks Lari! -- 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=16699 Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |16330 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16330 [Bug 16330] REST API: add routes to add, update and delete patrons -- 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=16699 Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |13895 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13895 [Bug 13895] Add API routes for checkouts retrieval and renewal -- 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=16699 Jiri Kozlovsky <mail@jkozlovsky.cz> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |16652 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16652 [Bug 16652] Omnibus: RestfulAPI supporting services for Vufind and for xnciptoolkit drivers -- 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