Bugzilla – Attachment 52989 Details for
Bug 16699
Swagger: Split parameters and paths, and specify required permissions for resource
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED-OFF] Bug 16699: Support multiple types in primitive definitions
SIGNED-OFF-Bug-16699-Support-multiple-types-in-pri.patch (text/plain), 3.47 KB, created by
Johanna Räisä
on 2016-06-30 13:52:34 UTC
(
hide
)
Description:
[SIGNED-OFF] Bug 16699: Support multiple types in primitive definitions
Filename:
MIME Type:
Creator:
Johanna Räisä
Created:
2016-06-30 13:52:34 UTC
Size:
3.47 KB
patch
obsolete
>From bd577fa793b1068aa4acf801bb82552ea6aed06a Mon Sep 17 00:00:00 2001 >From: Lari Taskula <larit@student.uef.fi> >Date: Tue, 14 Jun 2016 12:53:58 +0300 >Subject: [PATCH] [SIGNED-OFF] Bug 16699: Support multiple types in primitive > definitions >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >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. >--- > api/v1/swagger.json | 3 +++ > api/v1/x-primitives.json | 41 +++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 44 insertions(+) > create mode 100644 api/v1/x-primitives.json > >diff --git a/api/v1/swagger.json b/api/v1/swagger.json >index 362780a..249e71b 100644 >--- a/api/v1/swagger.json >+++ b/api/v1/swagger.json >@@ -21,5 +21,8 @@ > }, > "parameters": { > "$ref": "parameters.json" >+ }, >+ "x-primitives": { >+ "$ref": "x-primitives.json" > } > } >diff --git a/api/v1/x-primitives.json b/api/v1/x-primitives.json >new file mode 100644 >index 0000000..ae8750e >--- /dev/null >+++ b/api/v1/x-primitives.json >@@ -0,0 +1,41 @@ >+{ >+ "biblionumber": { >+ "type": "string", >+ "description": "internally assigned biblio identifier" >+ }, >+ "borrowernumber": { >+ "type": "string", >+ "description": "internally assigned user identifier" >+ }, >+ "branchcode": { >+ "type": ["string", "null"], >+ "description": "code of patron's home branch" >+ }, >+ "cardnumber": { >+ "type": ["string", "null"], >+ "description": "library assigned user identifier" >+ }, >+ "email": { >+ "type": ["string", "null"], >+ "description": "primary email address for patron's primary address" >+ }, >+ "firstname": { >+ "type": ["string", "null"], >+ "description": "patron's first name" >+ }, >+ "itemnumber": { >+ "type": ["string", "null"], >+ "description": "internally assigned item identifier" >+ }, >+ "phone": { >+ "type": ["string", "null"], >+ "description": "primary phone number for patron's primary address" >+ }, >+ "reserve_id": { >+ "description": "Internal hold identifier" >+ }, >+ "surname": { >+ "type": "string", >+ "description": "patron's last name" >+ } >+} >-- >1.9.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 16699
:
52375
|
52376
|
52377
|
52378
|
52379
|
52380
|
52580
|
52581
|
52956
|
52957
|
52958
|
52959
|
52960
|
52961
|
52962
|
52974
|
52975
|
52976
|
52978
|
52979
|
52980
|
52986
|
52987
|
52988
|
52989
|
52990
|
52991
|
54299
|
54300
|
54301
|
54302
|
54303
|
54304
|
54311
|
54372
|
54884
|
54885
|
54886
|
54887
|
54888
|
54889
|
54890
|
54891
|
54892