JSON::V...enAPIv3(3)
β¨ JSON::V...enAPIv3(3) β¨
okay so this is the JSON::V...enAPIv3(3) page from User Contributed Perl Documentation, and we're gonna make it make sense, bestie. π
π NAME π
JSON::Validator::Schema::OpenAPIv3 β OpenAPI version 3
π¦ SYNOPSIS π¦
See "SYNOPSIS" in JSON::Validator::Schema::OpenAPIv2.
πΈ DESCRIPTION πΈ
This class represents <https://spec.openapis.org/oas/3.0/schema/2019-04-02>.
π ATTRIBUTES π
π errors π
my $array_ref = $schema->errors;
See "errors" in JSON::Validator::Schema.
π moniker π
$str = $schema->moniker;
$schema = $schema->moniker("openapiv3");
Used to get/set the moniker for the given schema. Default value is "openapiv3".
π specification π
my $str = $schema->specification;
my $schema = $schema->specification($str);
Defaults to <https://spec.openapis.org/oas/3.0/schema/2019-04-02>.
π₯ METHODS π₯
π add_default_response π
$schema = $schema->add_default_response(\%params);
See "add_default_response" in JSON::Validator::Schema::OpenAPIv2 for details.
π base_url π
$url = $schema->base_url;
$schema = $schema->base_url($url);
Can get or set the default URL for this schema. $url can be either a Mojo::URL object or a plain string.
This method will read or write "/servers/0/url" in "data".
π coerce π
my $schema = $schema->coerce({booleans => 1, numbers => 1, strings => 1});
my $hash_ref = $schema->coerce;
Coercion is enabled by default, since headers, path parts, query parameters, ... are in most cases strings.
π new π
$schema = JSON::Validator::Schema::OpenAPIv2->new(\%attrs);
$schema = JSON::Validator::Schema::OpenAPIv2->new;
Same as "new" in JSON::Validator::Schema, but will also build L/coerce>.
π parameters_for_request π
$parameters = $schema->parameters_for_request([$method, $path]);
Finds all the request parameters defined in the schema, including inherited parameters. Returns undef if the $path and $method cannot be found.
Example return value:
[
{in => "query", name => "q"},
{in => "body", name => "body", accepts => ["application/json"]},
]
The return value MUST not be mutated.
π parameters_for_response π
$array_ref = $schema->parameters_for_response([$method, $path, $status]);
Finds the response parameters defined in the schema. Returns undef if the $path, $method and $status cannot be found. Will default to the "default" response definition if $status could not be found and "default" exists.
Example return value:
[
{in => "header", name => "X-Foo"},
{in => "body", name => "body", accepts => ["application/json"]},
]
The return value MUST not be mutated.
π routes π
$collection = $schema->routes;
Shares the same interface as "routes" in JSON::Validator::Schema::OpenAPIv2.
π validate_request π
@errors = $schema->validate_request([$method, $path], \%req);
Shares the same interface as "validate_request" in JSON::Validator::Schema::OpenAPIv2.
π validate_response π
@errors = $schema->validate_response([$method, $path], \%req);
Shares the same interface as "validate_response" in JSON::Validator::Schema::OpenAPIv2.
π SEE ALSO π
JSON::Validator::Schema, JSON::Validator::Schema::OpenAPIv2 and and JSON::Validator.
XOXO bestie, that's the whole page π β signing off from JSON::V...enAPIv3(3), with perl v5.42.0 and dated 2025-03-17. πβ¨
π¦ where this page comes from
- opensuse-leap 16.0: perl-JSON-Validator 5.150.0-bp160.1.1 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms