1JSON::Validator::SchemaU:s:eOrpeCnoAnPtIrvi3b(u3t)ed PerJlSODNo:c:uVmaelnitdaattioorn::Schema::OpenAPIv3(3)
2
3
4

NAME

6       JSON::Validator::Schema::OpenAPIv3 - OpenAPI version 3
7

SYNOPSIS

9       See "SYNOPSIS" in JSON::Validator::Schema::OpenAPIv2.
10

DESCRIPTION

12       This class represents
13       <https://spec.openapis.org/oas/3.0/schema/2019-04-02>.
14

ATTRIBUTES

16   moniker
17         $str    = $schema->moniker;
18         $schema = $schema->moniker("openapiv3");
19
20       Used to get/set the moniker for the given schema. Default value is
21       "openapiv3".
22
23   specification
24         my $str    = $schema->specification;
25         my $schema = $schema->specification($str);
26
27       Defaults to "<https://spec.openapis.org/oas/3.0/schema/2019-04-02>".
28

METHODS

30   add_default_response
31         $schema = $schema->add_default_response(\%params);
32
33       See "add_default_response" in JSON::Validator::Schema::OpenAPIv2 for
34       details.
35
36   base_url
37         $url = $schema->base_url;
38         $schema = $schema->base_url($url);
39
40       Can get or set the default URL for this schema. $url can be either a
41       Mojo::URL object or a plain string.
42
43       This method will read or write "/servers/0/url" in "data".
44
45   coerce
46         my $schema   = $schema->coerce({booleans => 1, numbers => 1, strings => 1});
47         my $hash_ref = $schema->coerce;
48
49       Coercion is enabled by default, since headers, path parts, query
50       parameters, ... are in most cases strings.
51
52   new
53         $schema = JSON::Validator::Schema::OpenAPIv2->new(\%attrs);
54         $schema = JSON::Validator::Schema::OpenAPIv2->new;
55
56       Same as "new" in JSON::Validator::Schema, but will also build
57       L/coerce>.
58
59   parameters_for_request
60         $parameters = $schema->parameters_for_request([$method, $path]);
61
62       Finds all the request parameters defined in the schema, including
63       inherited parameters. Returns "undef" if the $path and $method cannot
64       be found.
65
66       Example return value:
67
68         [
69           {in => "query", name => "q"},
70           {in => "body", name => "body", accepts => ["application/json"]},
71         ]
72
73       The return value MUST not be mutated.
74
75   parameters_for_response
76         $array_ref = $schema->parameters_for_response([$method, $path, $status]);
77
78       Finds the response parameters defined in the schema. Returns "undef" if
79       the $path, $method and $status cannot be found. Will default to the
80       "default" response definition if $status could not be found and
81       "default" exists.
82
83       Example return value:
84
85         [
86           {in => "header", name => "X-Foo"},
87           {in => "body", name => "body", accepts => ["application/json"]},
88         ]
89
90       The return value MUST not be mutated.
91
92   routes
93         $collection = $schema->routes;
94
95       Shares the same interface as "routes" in
96       JSON::Validator::Schema::OpenAPIv2.
97
98   validate_request
99         @errors = $schema->validate_request([$method, $path], \%req);
100
101       Shares the same interface as "validate_request" in
102       JSON::Validator::Schema::OpenAPIv2.
103
104   validate_response
105         @errors = $schema->validate_response([$method, $path], \%req);
106
107       Shares the same interface as "validate_response" in
108       JSON::Validator::Schema::OpenAPIv2.
109

SEE ALSO

111       JSON::Validator::Schema, JSON::Validator::Schema::OpenAPIv2 and and
112       JSON::Validator.
113
114
115
116perl v5.34.0                      2021-07-J2S2ON::Validator::Schema::OpenAPIv3(3)
Impressum