-
-
16 May 2022 04:22:10 UTC
- Distribution: OpenAPI-Modern
- Module version: 0.029
- Source (raw)
- Browse (raw)
- Changes
- Homepage
- How to Contribute
- Repository
- Issues
- Testers (151 / 0 / 0)
- Kwalitee
Bus factor: 1- 93.06% Coverage
- License: perl_5
- Perl: v5.20.0
- Activity
24 month- Tools
- Download (71.07KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- Carp
- Encode
- Feature::Compat::Try
- File::ShareDir
- JSON::Schema::Modern
- JSON::Schema::Modern::Document
- JSON::Schema::Modern::Utilities
- JSON::Schema::Modern::Vocabulary
- List::Util
- Math::BigInt
- Moo
- MooX::HandlesVia
- MooX::TypeTiny
- Path::Tiny
- Ref::Util
- Safe::Isa
- Scalar::Util
- Types::Standard
- URI::Escape
- constant
- experimental
- if
- namespace::clean
- strict
- strictures
- warnings
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
JSON::Schema::Modern::Document::OpenAPI - One OpenAPI v3.1 document
VERSION
version 0.029
SYNOPSIS
use JSON::Schema::Modern; use JSON::Schema::Modern::Document::OpenAPI; my $js = JSON::Schema::Modern->new; my $openapi_document = JSON::Schema::Modern::Document::OpenAPI->new( evaluator => $js, canonical_uri => 'https://example.com/v1/api', schema => $schema, metaschema_uri => 'https://example.com/my_custom_dialect', );
DESCRIPTION
Provides structured parsing of an OpenAPI document, suitable as the base for more tooling such as request and response validation, code generation or form generation.
The provided document must be a valid OpenAPI document, as specified by the schema identified by
https://spec.openapis.org/oas/3.1/schema-base/latest
(an alias for the latest document available)and the OpenAPI v3.1 specification.
ATTRIBUTES
These values are all passed as arguments to the constructor.
This class inherits all options from JSON::Schema::Modern::Document and implements the following new ones:
evaluator
A JSON::Schema::Modern object. Unlike in the parent class, this is REQUIRED, because loaded vocabularies, metaschemas and resource identifiers must be stored here as they are discovered in the OpenAPI document. This is the object that will be used for subsequent evaluation of data against schemas in the document, either manually or perhaps via a web framework plugin (coming soon).
metaschema_uri
The URI of the schema that describes the OpenAPI document itself. Defaults to
https://spec.openapis.org/oas/3.1/schema-base/latest
(an alias for the latest document available).json_schema_dialect
The URI of the metaschema to use for all embedded JSON Schemas in the document.
Overrides the value of
jsonSchemaDialect
in the document, or the specification default (https://spec.openapis.org/oas/3.1/dialect/base
).If you specify your own dialect here or in
jsonSchemaDialect
, then you need to add the vocabularies and schemas to the implementation yourself. (seeJSON::Schema::Modern/add_vocabulary
andJSON::Schema::Modern/add_schema
).Note this is NOT the same as "metaschema_uri" in JSON::Schema::Modern::Document, which contains the URI describing the entire document (and is not a metaschema in this case, as the entire document is not a JSON Schema). Note that you may need to explicitly set that attribute as well if you change
json_schema_dialect
, as the default metaschema used by the defaultmetaschema_uri
can no longer be assumed.METHODS
get_operationId_path
Returns the json pointer location of the operation containing the provided
operationId
(suitable for passing to$document->get(..)
), orundef
if the location does not exist in the document.SEE ALSO
SUPPORT
Bugs may be submitted through https://github.com/karenetheridge/OpenAPI-Modern/issues.
I am also usually active on irc, as 'ether' at
irc.perl.org
andirc.libera.chat
.You can also find me on the JSON Schema Slack server and OpenAPI Slack server, which are also great resources for finding help.
AUTHOR
Karen Etheridge <ether@cpan.org>
COPYRIGHT AND LICENCE
This software is copyright (c) 2021 by Karen Etheridge.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
Some schema files have their own licence, in share/oas/LICENSE.
Module Install Instructions
To install OpenAPI::Modern, copy and paste the appropriate command in to your terminal.
cpanm OpenAPI::Modern
perl -MCPAN -e shell install OpenAPI::Modern
For more information on module installation, please visit the detailed CPAN module installation guide.