yori 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.editorconfig +14 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/.rubocop.yml +15 -0
- data/.ruby-version +1 -0
- data/.travis.yml +7 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +35 -0
- data/LICENSE.txt +21 -0
- data/README.md +44 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/yori.rb +16 -0
- data/lib/yori/errors/field_must_not_be_specified_error.rb +5 -0
- data/lib/yori/errors/invalid_schema_error.rb +5 -0
- data/lib/yori/errors/missing_required_field_error.rb +5 -0
- data/lib/yori/errors/unknown_component_error.rb +7 -0
- data/lib/yori/schema/any.rb +22 -0
- data/lib/yori/schema/v3.rb +10 -0
- data/lib/yori/schema/v3/callback.rb +15 -0
- data/lib/yori/schema/v3/components.rb +70 -0
- data/lib/yori/schema/v3/composer.rb +36 -0
- data/lib/yori/schema/v3/contact.rb +15 -0
- data/lib/yori/schema/v3/discriminator.rb +25 -0
- data/lib/yori/schema/v3/encoding.rb +33 -0
- data/lib/yori/schema/v3/example.rb +20 -0
- data/lib/yori/schema/v3/external_documentation.rb +18 -0
- data/lib/yori/schema/v3/header.rb +32 -0
- data/lib/yori/schema/v3/info.rb +27 -0
- data/lib/yori/schema/v3/license.rb +18 -0
- data/lib/yori/schema/v3/link.rb +46 -0
- data/lib/yori/schema/v3/media_type.rb +35 -0
- data/lib/yori/schema/v3/oauth_flow.rb +35 -0
- data/lib/yori/schema/v3/oauth_flows.rb +51 -0
- data/lib/yori/schema/v3/openapi.rb +61 -0
- data/lib/yori/schema/v3/operation.rb +72 -0
- data/lib/yori/schema/v3/parameter.rb +63 -0
- data/lib/yori/schema/v3/path_item.rb +47 -0
- data/lib/yori/schema/v3/paths.rb +44 -0
- data/lib/yori/schema/v3/request_body.rb +27 -0
- data/lib/yori/schema/v3/response.rb +34 -0
- data/lib/yori/schema/v3/responses.rb +42 -0
- data/lib/yori/schema/v3/root.rb +40 -0
- data/lib/yori/schema/v3/schema.rb +35 -0
- data/lib/yori/schema/v3/security_requirement.rb +23 -0
- data/lib/yori/schema/v3/security_scheme.rb +93 -0
- data/lib/yori/schema/v3/server.rb +24 -0
- data/lib/yori/schema/v3/server_variable.rb +25 -0
- data/lib/yori/schema/v3/tag.rb +28 -0
- data/lib/yori/schema/v3/xml.rb +28 -0
- data/lib/yori/schema_base.rb +110 -0
- data/lib/yori/schema_validator.rb +40 -0
- data/lib/yori/version.rb +3 -0
- data/yori.gemspec +44 -0
- metadata +142 -0
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'yori/schema/v3/components'
|
4
|
+
require 'yori/schema/v3/paths'
|
5
|
+
|
6
|
+
module Yori
|
7
|
+
module Schema
|
8
|
+
module V3
|
9
|
+
# Provides register_component method
|
10
|
+
class Composer
|
11
|
+
def initialize(id)
|
12
|
+
@id = id
|
13
|
+
end
|
14
|
+
|
15
|
+
attr_reader :id
|
16
|
+
|
17
|
+
Yori::Schema::V3::Components::VALID_COMPONENTS.each do |component|
|
18
|
+
define_method(component) do |key, value = nil, &block|
|
19
|
+
Yori::Schema::V3::Components.register_component(id, component, key, value, &block)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def path(key, value = nil, &block)
|
24
|
+
Yori::Schema::V3::Paths.register_path(id, key, value, &block)
|
25
|
+
end
|
26
|
+
|
27
|
+
class << self
|
28
|
+
def register(id = '', &block)
|
29
|
+
composer = new(id)
|
30
|
+
composer.instance_eval(&block)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Yori
|
4
|
+
module Schema
|
5
|
+
module V3
|
6
|
+
# Contact: Contact information for the exposed API.
|
7
|
+
# @name: The identifying name of the contact person/organization.
|
8
|
+
# @url: The URL pointing to the contact information. MUST be in the format of a URL.
|
9
|
+
# @email: The email address of the contact person/organization. MUST be in the format of an email address.
|
10
|
+
class Contact < Yori::SchemaBase
|
11
|
+
fields :name, :url, :email
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Yori
|
4
|
+
module Schema
|
5
|
+
module V3
|
6
|
+
# Discriminator
|
7
|
+
# When request bodies or response payloads may be one of a number of different schemas,
|
8
|
+
# a discriminator object can be used to aid in serialization, deserialization, and validation.
|
9
|
+
# The discriminator is a specific object in a schema which is used to inform the consumer of the specification of an alternative schema based on the value associated with it.
|
10
|
+
# When using the discriminator, inline schemas will not be considered.
|
11
|
+
class Discriminator < Yori::SchemaBase
|
12
|
+
# @!method propertyName
|
13
|
+
# REQUIRED. The name of the property in the payload that will hold the discriminator value.
|
14
|
+
fields :propertyName
|
15
|
+
# @!method mapping
|
16
|
+
# An object to hold mappings between payload values and schema names or references.
|
17
|
+
hash_field :mapping, :map
|
18
|
+
|
19
|
+
def validate!
|
20
|
+
validate_require_fields!('propertyName')
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Yori
|
4
|
+
module Schema
|
5
|
+
module V3
|
6
|
+
# Encoding: A single encoding definition applied to a single schema property.
|
7
|
+
class Encoding < Yori::SchemaBase
|
8
|
+
# @!method contentType
|
9
|
+
# The Content-Type for encoding a specific property.
|
10
|
+
# Default value depends on the property type:
|
11
|
+
# for string with format being binary - application/octet-stream;
|
12
|
+
# for other primitive types - text/plain; for object - application/json;
|
13
|
+
# for array - the default is defined based on the inner type.
|
14
|
+
# The value can be a specific media type (e.g. application/json), a wildcard media type (e.g. image/*), or a comma-separated list of the two types.
|
15
|
+
# @!method style
|
16
|
+
# Describes how a specific property value will be serialized depending on its type.
|
17
|
+
# See Parameter Object for details on the style property. The behavior follows the same values as query parameters, including default values.
|
18
|
+
# This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded.
|
19
|
+
# @!method explode
|
20
|
+
# When this is true, property values of type array or object generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect.
|
21
|
+
# When style is form, the default value is true. For all other styles, the default value is false.
|
22
|
+
# This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded.
|
23
|
+
# @!method allowReserved
|
24
|
+
# Determines whether the parameter value SHOULD allow reserved characters, as defined by RFC3986 :/?#[]@!$&'()*+,;= to be included without percent-encoding. The default value is false.
|
25
|
+
# This property SHALL be ignored if the request body media type is not application/x-www-form-urlencoded.
|
26
|
+
fields :contentType, :style, :explode, :allowReserved
|
27
|
+
|
28
|
+
# headers are defined at yori/schema/v3/header.rb
|
29
|
+
# to avoid circular reference.
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Yori
|
4
|
+
module Schema
|
5
|
+
module V3
|
6
|
+
# Example:
|
7
|
+
# @summary: Short description for the example.
|
8
|
+
# @description: Long description for the example. CommonMark syntax MAY be used for rich text representation.
|
9
|
+
# @value: Embedded literal example. The value field and externalValue field are mutually exclusive. To represent examples of media types that cannot naturally represented in JSON or YAML, use a string value to contain the example, escaping where necessary.
|
10
|
+
# @externalValue: A URL that points to the literal example. This provides the capability to reference examples that cannot easily be included in JSON or YAML documents. The value field and externalValue field are mutually exclusive.
|
11
|
+
class Example < Yori::SchemaBase
|
12
|
+
fields :summary, :description, :value, :externalValue
|
13
|
+
|
14
|
+
def validate!
|
15
|
+
validate_mutually_exclusive_fields!('value', 'externalValue')
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Yori
|
4
|
+
module Schema
|
5
|
+
module V3
|
6
|
+
# ExternalDocumentation: Allows referencing an external resource for extended documentation.
|
7
|
+
# @description: A short description of the target documentation. CommonMark syntax MAY be used for rich text representation.
|
8
|
+
# @url: REQUIRED. The URL for the target documentation. Value MUST be in the format of a URL.
|
9
|
+
class ExternalDocumentation < Yori::SchemaBase
|
10
|
+
fields :description, :url
|
11
|
+
|
12
|
+
def validate!
|
13
|
+
validate_require_fields!('url')
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'yori/schema/v3/parameter'
|
4
|
+
|
5
|
+
module Yori
|
6
|
+
module Schema
|
7
|
+
module V3
|
8
|
+
# Header: The Header Object follows the structure of the Parameter Object with the following changes:
|
9
|
+
# 1. name MUST NOT be specified, it is given in the corresponding headers map.
|
10
|
+
# 2. in MUST NOT be specified, it is implicitly in header.
|
11
|
+
# 3. All traits that are affected by the location MUST be applicable to a location of header (for example, style).
|
12
|
+
class Header < Yori::Schema::V3::Parameter
|
13
|
+
def validate!
|
14
|
+
%w[name in].each do |field|
|
15
|
+
raise Yori::Errors::FieldMustNotBeSpecifiedError, "#{field} of Header Object." if key?(field)
|
16
|
+
end
|
17
|
+
validate_schema_or_content!
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
# ref yori/schema/v3/encoding
|
22
|
+
# partial definition to avoid circular reference.
|
23
|
+
class Encoding < Yori::SchemaBase
|
24
|
+
# @!method headers
|
25
|
+
# A map allowing additional information to be provided as headers, for example Content-Disposition.
|
26
|
+
# Content-Type is described separately and SHALL be ignored in this section.
|
27
|
+
# This property SHALL be ignored if the request body media type is not a multipart.
|
28
|
+
hash_field_block :headers, :header, Yori::Schema::V3::Header
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'yori/schema/v3/contact'
|
4
|
+
require 'yori/schema/v3/license'
|
5
|
+
|
6
|
+
module Yori
|
7
|
+
module Schema
|
8
|
+
module V3
|
9
|
+
# Info: The object provides metadata about the API. The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience.
|
10
|
+
# @title: REQUIRED. The title of the application.
|
11
|
+
# @description: A short description of the application. CommonMark syntax MAY be used for rich text representation.
|
12
|
+
# @termsOfService: A URL to the Terms of Service for the API. MUST be in the format of a URL.
|
13
|
+
# @contact: The contact information for the exposed API.
|
14
|
+
# @license: The license information for the exposed API.
|
15
|
+
# @version: REQUIRED. The version of the OpenAPI document (which is distinct from the OpenAPI Specification version or the API implementation version).
|
16
|
+
class Info < Yori::SchemaBase
|
17
|
+
fields :title, :description, :termsOfService, :version
|
18
|
+
field_block :contact, Yori::Schema::V3::Contact
|
19
|
+
field_block :license, Yori::Schema::V3::License
|
20
|
+
|
21
|
+
def validate!
|
22
|
+
validate_require_fields!('title', 'version')
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Yori
|
4
|
+
module Schema
|
5
|
+
module V3
|
6
|
+
# License: License information for the exposed API.
|
7
|
+
# @name: REQUIRED. The license name used for the API.
|
8
|
+
# @url: A URL to the license used for the API. MUST be in the format of a URL.
|
9
|
+
class License < Yori::SchemaBase
|
10
|
+
fields :name, :url
|
11
|
+
|
12
|
+
def validate!
|
13
|
+
validate_require_fields!('name')
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'yori/schema/v3/server'
|
4
|
+
|
5
|
+
module Yori
|
6
|
+
module Schema
|
7
|
+
module V3
|
8
|
+
# Link:
|
9
|
+
# The Link object represents a possible design-time link for a response.
|
10
|
+
# The presence of a link does not guarantee the caller's ability to successfully invoke it,
|
11
|
+
# rather it provides a known relationship and traversal mechanism between responses and other operations.
|
12
|
+
# Unlike dynamic links (i.e. links provided in the response payload),
|
13
|
+
# the OAS linking mechanism does not require link information in the runtime response.
|
14
|
+
# For computing links, and providing instructions to execute them,
|
15
|
+
# a runtime expression is used for accessing values in an operation and using them as parameters while invoking the linked operation.
|
16
|
+
class Link < Yori::SchemaBase
|
17
|
+
# @!method operationRef
|
18
|
+
# A relative or absolute reference to an OAS operation.
|
19
|
+
# This field is mutually exclusive of the operationId field, and MUST point to an Operation Object.
|
20
|
+
# Relative operationRef values MAY be used to locate an existing Operation Object in the OpenAPI definition.
|
21
|
+
# @!method operationId
|
22
|
+
# The name of an existing, resolvable OAS operation, as defined with a unique operationId.
|
23
|
+
# This field is mutually exclusive of the operationRef field.
|
24
|
+
fields :operationRef, :operationId
|
25
|
+
# @!method parameters
|
26
|
+
# A map representing parameters to pass to an operation as specified with operationId or identified via operationRef.
|
27
|
+
# The key is the parameter name to be used, whereas the value can be a constant or an expression to be evaluated and passed to the linked operation.
|
28
|
+
# The parameter name can be qualified using the parameter location [{in}.]{name} for operations that use the same parameter name in different locations (e.g. path.id).
|
29
|
+
hash_field_block :parameters, :parameter, Yori::Schema::Any
|
30
|
+
# @!method requestBody
|
31
|
+
# A literal value or {expression} to use as a request body when calling the target operation.
|
32
|
+
field_block :requestBody, Yori::Schema::Any
|
33
|
+
# @!method description
|
34
|
+
# A description of the link. CommonMark syntax MAY be used for rich text representation.
|
35
|
+
fields :description
|
36
|
+
# @!method server
|
37
|
+
# A server object to be used by the target operation.
|
38
|
+
field_block :server, Yori::Schema::V3::Server
|
39
|
+
|
40
|
+
def validate!
|
41
|
+
validate_mutually_exclusive_fields!('operationId', 'operationRef')
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'yori/schema/v3/example'
|
4
|
+
require 'yori/schema/v3/encoding'
|
5
|
+
|
6
|
+
module Yori
|
7
|
+
module Schema
|
8
|
+
module V3
|
9
|
+
# MediaType: Each Media Type Object provides schema and examples for the media type identified by its key.
|
10
|
+
class MediaType < Yori::SchemaBase
|
11
|
+
# @!method schema
|
12
|
+
# The schema defining the type used for the request body.
|
13
|
+
field_block :schema, Yori::Schema::V3::Schema
|
14
|
+
|
15
|
+
# @!method example_any
|
16
|
+
# Example of the media type. The example object SHOULD be in the correct format as specified by the media type.
|
17
|
+
# The example object is mutually exclusive of the examples object. Furthermore, if referencing a schema which contains an example,
|
18
|
+
# the example value SHALL override the example provided by the schema.
|
19
|
+
def example_any(value)
|
20
|
+
self['example'] = value
|
21
|
+
end
|
22
|
+
|
23
|
+
# @!method examples
|
24
|
+
# Examples of the media type. Each example object SHOULD match the media type and specified schema if present.
|
25
|
+
# The examples object is mutually exclusive of the example object. Furthermore, if referencing a schema which contains an example,
|
26
|
+
# the examples value SHALL override the example provided by the schema.
|
27
|
+
hash_field_block :examples, :example, Yori::Schema::V3::Example
|
28
|
+
# @!method encoding
|
29
|
+
# A map between a property name and its encoding information. The key, being the property name, MUST exist in the schema as a property.
|
30
|
+
# The encoding object SHALL only apply to requestBody objects when the media type is multipart or application/x-www-form-urlencoded.
|
31
|
+
hash_field_block :encoding, :property, Yori::Schema::V3::Encoding
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Yori
|
4
|
+
module Schema
|
5
|
+
module V3
|
6
|
+
# OAuthFlow: Configuration details for a supported OAuth Flow
|
7
|
+
class OAuthFlow < Yori::SchemaBase
|
8
|
+
# @!method authorizationUrl
|
9
|
+
# REQUIRED. The authorization URL to be used for this flow. This MUST be in the form of a URL.
|
10
|
+
# @!method tokenUrl
|
11
|
+
# REQUIRED. The token URL to be used for this flow. This MUST be in the form of a URL.
|
12
|
+
# @!method refreshUrl
|
13
|
+
# The URL to be used for obtaining refresh tokens. This MUST be in the form of a URL.
|
14
|
+
fields :authorizationUrl, :tokenUrl, :refreshUrl
|
15
|
+
|
16
|
+
# @!method scopes
|
17
|
+
# REQUIRED. The available scopes for the OAuth2 security scheme.
|
18
|
+
# A map between the scope name and a short description for it.
|
19
|
+
def scopes(&block)
|
20
|
+
self['scopes'] = {}
|
21
|
+
instance_eval(&block)
|
22
|
+
end
|
23
|
+
|
24
|
+
def scope(key, value)
|
25
|
+
self['scopes'] ||= {}
|
26
|
+
self['scopes'][key.to_s] = value.to_s
|
27
|
+
end
|
28
|
+
|
29
|
+
def validate!
|
30
|
+
validate_require_fields!('scopes')
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'yori/schema/v3/oauth_flow'
|
4
|
+
|
5
|
+
module Yori
|
6
|
+
module Schema
|
7
|
+
module V3
|
8
|
+
# OAuthFlows: Allows configuration of the supported OAuth Flows.
|
9
|
+
class OAuthFlows < Yori::SchemaBase
|
10
|
+
# @!method implicit
|
11
|
+
# Configuration for the OAuth Implicit flow
|
12
|
+
field_block :implicit, Yori::Schema::V3::OAuthFlow
|
13
|
+
# @!method password
|
14
|
+
# Configuration for the OAuth Resource Owner Password flow
|
15
|
+
field_block :password, Yori::Schema::V3::OAuthFlow
|
16
|
+
# @!method clientCredentials
|
17
|
+
# Configuration for the OAuth Client Credentials flow.
|
18
|
+
# Previously called application in OpenAPI 2.0.
|
19
|
+
field_block :clientCredentials, Yori::Schema::V3::OAuthFlow
|
20
|
+
# @!method authorizationCode
|
21
|
+
# Configuration for the OAuth Authorization Code flow.
|
22
|
+
# Previously called accessCode in OpenAPI 2.0.
|
23
|
+
field_block :authorizationCode, Yori::Schema::V3::OAuthFlow
|
24
|
+
|
25
|
+
def validate!
|
26
|
+
%w[implicit clientCredentials authorizationCode].each do |field|
|
27
|
+
validate_flow!(field)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def validate_flow!(flow)
|
32
|
+
oauth_flow = self[flow]
|
33
|
+
oauth_flow&.validate_require_fields!(*required_flow_fields(flow))
|
34
|
+
end
|
35
|
+
|
36
|
+
def required_flow_fields(flow)
|
37
|
+
case flow
|
38
|
+
when 'implicit'
|
39
|
+
%w[authorizationUrl]
|
40
|
+
when 'clientCredentials'
|
41
|
+
%w[tokenUrl]
|
42
|
+
when 'authorizationCode'
|
43
|
+
%w[authorizationUrl tokenUrl]
|
44
|
+
else
|
45
|
+
[]
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'yori/schema/v3/info'
|
4
|
+
require 'yori/schema/v3/server'
|
5
|
+
require 'yori/schema/v3/paths'
|
6
|
+
require 'yori/schema/v3/components'
|
7
|
+
require 'yori/schema/v3/security_requirement'
|
8
|
+
require 'yori/schema/v3/tag'
|
9
|
+
require 'yori/schema/v3/external_documentation'
|
10
|
+
|
11
|
+
module Yori
|
12
|
+
module Schema
|
13
|
+
module V3
|
14
|
+
# OpenAPI
|
15
|
+
# This is the root document object of the OpenAPI document.
|
16
|
+
class OpenAPI < Yori::SchemaBase
|
17
|
+
# @!method openapi
|
18
|
+
# REQUIRED. This string MUST be the semantic version number of the OpenAPI Specification version that the OpenAPI document uses.
|
19
|
+
# The openapi field SHOULD be used by tooling specifications and clients to interpret the OpenAPI document.
|
20
|
+
# This is not related to the API info.version string.
|
21
|
+
fields :openapi
|
22
|
+
# @!method info
|
23
|
+
# REQUIRED. Provides metadata about the API.
|
24
|
+
# The metadata MAY be used by tooling as required.
|
25
|
+
field_block :info, Yori::Schema::V3::Info
|
26
|
+
# @!method servers
|
27
|
+
# An array of Server Objects, which provide connectivity information to a target server.
|
28
|
+
# If the servers property is not provided, or is an empty array, the default value would be a Server Object with a url value of /.
|
29
|
+
array_field_block :servers, :server, Yori::Schema::V3::Server
|
30
|
+
# @!method paths
|
31
|
+
# REQUIRED. The available paths and operations for the API.
|
32
|
+
field_block :paths, Yori::Schema::V3::Paths
|
33
|
+
|
34
|
+
# @!method components
|
35
|
+
# An element to hold various schemas for the specification.
|
36
|
+
field_block :components, Yori::Schema::V3::Components
|
37
|
+
|
38
|
+
# @!method security
|
39
|
+
# A declaration of which security mechanisms can be used across the API.
|
40
|
+
# The list of values includes alternative security requirement objects that can be used.
|
41
|
+
# Only one of the security requirement objects need to be satisfied to authorize a request.
|
42
|
+
# Individual operations can override this definition.
|
43
|
+
array_field_block :security, :requirement, Yori::Schema::V3::SecurityRequirement
|
44
|
+
# @!method tags
|
45
|
+
# A list of tags used by the specification with additional metadata.
|
46
|
+
# The order of the tags can be used to reflect on their order by the parsing tools.
|
47
|
+
# Not all tags that are used by the Operation Object must be declared.
|
48
|
+
# The tags that are not declared MAY be organized randomly or based on the tools' logic.
|
49
|
+
# Each tag name in the list MUST be unique.
|
50
|
+
array_field_block :tags, :tag, Yori::Schema::V3::Tag
|
51
|
+
# @!method externalDocs
|
52
|
+
# Additional external documentation.
|
53
|
+
field_block :externalDocs, Yori::Schema::V3::ExternalDocumentation
|
54
|
+
|
55
|
+
def validate!
|
56
|
+
validate_require_fields!('openapi', 'info', 'paths')
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|