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   errors
17         my $array_ref = $schema->errors;
18
19       See "errors" in JSON::Validator::Schema.
20
21   moniker
22         $str    = $schema->moniker;
23         $schema = $schema->moniker("openapiv3");
24
25       Used to get/set the moniker for the given schema. Default value is
26       "openapiv3".
27
28   specification
29         my $str    = $schema->specification;
30         my $schema = $schema->specification($str);
31
32       Defaults to "<https://spec.openapis.org/oas/3.0/schema/2019-04-02>".
33

METHODS

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

SEE ALSO

116       JSON::Validator::Schema, JSON::Validator::Schema::OpenAPIv2 and and
117       JSON::Validator.
118
119
120
121perl v5.34.0                      2022-01-J2S1ON::Validator::Schema::OpenAPIv3(3)
Impressum