1JSON::Validator::SchemaU:s:eOrpeCnoAnPtIrvi3b(u3t)ed PerJlSODNo:c:uVmaelnitdaattioorn::Schema::OpenAPIv3(3)
2
3
4
6 JSON::Validator::Schema::OpenAPIv3 - OpenAPI version 3
7
9 See "SYNOPSIS" in JSON::Validator::Schema::OpenAPIv2.
10
12 This class represents
13 <https://spec.openapis.org/oas/3.0/schema/2019-04-02>.
14
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
30 coerce
31 my $schema = $schema->coerce({booleans => 1, numbers => 1, strings => 1});
32 my $hash_ref = $schema->coerce;
33
34 Coercion is enabled by default, since headers, path parts, query
35 parameters, ... are in most cases strings.
36
37 new
38 $schema = JSON::Validator::Schema::OpenAPIv2->new(\%attrs);
39 $schema = JSON::Validator::Schema::OpenAPIv2->new;
40
41 Same as "new" in JSON::Validator::Schema, but will also build
42 L/coerce>.
43
44 parameters_for_request
45 $parameters = $schema->parameters_for_request([$method, $path]);
46
47 Finds all the request parameters defined in the schema, including
48 inherited parameters. Returns "undef" if the $path and $method cannot
49 be found.
50
51 Example return value:
52
53 [
54 {in => "query", name => "q"},
55 {in => "body", name => "body", accepts => ["application/json"]},
56 ]
57
58 The return value MUST not be mutated.
59
60 parameters_for_response
61 $array_ref = $schema->parameters_for_response([$method, $path, $status]);
62
63 Finds the response parameters defined in the schema. Returns "undef" if
64 the $path, $method and $status cannot be found. Will default to the
65 "default" response definition if $status could not be found and
66 "default" exists.
67
68 Example return value:
69
70 [
71 {in => "header", name => "X-Foo"},
72 {in => "body", name => "body", accepts => ["application/json"]},
73 ]
74
75 The return value MUST not be mutated.
76
77 validate_request
78 @errors = $schema->validate_request([$method, $path], \%req);
79
80 Shares the same interface as "validate_request" in
81 JSON::Validator::Schema::OpenAPIv2.
82
83 validate_response
84 @errors = $schema->validate_response([$method, $path], \%req);
85
86 Shares the same interface as "validate_response" in
87 JSON::Validator::Schema::OpenAPIv2.
88
90 JSON::Validator::Schema, JSON::Validator::Schema::OpenAPIv2 and and
91 JSON::Validator.
92
93
94
95perl v5.32.1 2021-01-J3S1ON::Validator::Schema::OpenAPIv3(3)