.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.29) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Swagger2::Guides::JSONSchemaSupport 3pm" .TH Swagger2::Guides::JSONSchemaSupport 3pm "2016-04-17" "perl v5.22.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Swagger2::Guides::JSONSchemaSupport \- Adding json\-schema support \- EXPERIMENTAL .SH "DISCLAIMER" .IX Header "DISCLAIMER" This feature is both \s-1EXPERIMENTAL\s0 and \s-1DISCOURAGED.\s0 .PP Third party tooling will simply ignore the x\-json-schema property and thus not do any special handling on it's side for you. Paths that include this property will introduce unexpected consequences in third party client generators for instance, where the x\-json-schema will not be validated against and thus manual intervention will likely be needed for these paths. .SS "\s-1JUSTIFICATION\s0" .IX Subsection "JUSTIFICATION" By default json-schema schema's are not supported by the swagger specification (though it does use a sub/superset of the features). .PP This makes swagger incompatible with many recognised standards including json-patch . .PP To ovecome this and allow your specification files to remain 'valid', Mojolicious::Plugin::Swagger2 has added \&\s-1EXPERIMENTAL\s0 support for 'x\-json\-schema' for both input body and response validation. This means that should you choose to adopt one of the many standards that use json-schema and you cannot see a way of converting it to a swagger schema then you may still yield the benefits of request and response validation for those objects as outlined below. .SS "\s-1SYNOPSIS\s0" .IX Subsection "SYNOPSIS" .Vb 10 \& { \& "swagger":"2.0", \& "basePath":"/api", \& "paths":{ \& "/pets/{name}":{ \& "patch":{ \& "operationId":"patchPets", \& "parameters":[ \& { \& "name":"name", \& "in":"path", \& "type":"string" \& }, \& { \& "name":"data", \& "in":"body", \& "schema":{ \& "type":"object" \& }, \& "x\-json\-schema":{ \& "$ref":"http://json.schemastore.org/json\-patch" \& } \& } \& ], \& "responses":{ \& "226":{ \& "schema":{ \& "type":"object" \& }, \& "x\-json\-schema":{ \& "$ref":"http://json.schemastore.org/json\-patch" \& } \& } \& } \& } \& } \& } \& } .Ve .SS "\s-1AUTHOR\s0" .IX Subsection "AUTHOR" Martin Renvoize \- \f(CW\*(C`ashimema@cpan.org\*(C'\fR