scorpio 0.2.3 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +4 -2
- data/lib/scorpio.rb +9 -22
- data/lib/scorpio/google_api_document.rb +13 -16
- data/lib/scorpio/openapi.rb +141 -143
- data/lib/scorpio/openapi/document.rb +167 -0
- data/lib/scorpio/openapi/operation.rb +208 -0
- data/lib/scorpio/openapi/operations_scope.rb +29 -0
- data/lib/scorpio/openapi/v3/server.rb +32 -0
- data/lib/scorpio/request.rb +227 -0
- data/lib/scorpio/resource_base.rb +148 -182
- data/lib/scorpio/response.rb +34 -0
- data/lib/scorpio/ur.rb +33 -0
- data/lib/scorpio/version.rb +1 -1
- data/scorpio.gemspec +3 -4
- metadata +32 -36
- data/lib/scorpio/json-schema-fragments.rb +0 -191
- data/lib/scorpio/json.rb +0 -5
- data/lib/scorpio/json/node.rb +0 -256
- data/lib/scorpio/schema.rb +0 -249
- data/lib/scorpio/schema_instance_base.rb +0 -325
- data/lib/scorpio/schema_instance_base/to_rb.rb +0 -127
- data/lib/scorpio/schema_instance_json_coder.rb +0 -83
- data/lib/scorpio/struct_json_coder.rb +0 -30
- data/lib/scorpio/typelike_modules.rb +0 -164
- data/lib/scorpio/util.rb +0 -89
- data/lib/scorpio/util/faraday/response_media_type.rb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d6cc227b5ff884c520333ce9f3fd11f864dd8c58d1978a593195d98a63d61a1
|
4
|
+
data.tar.gz: e514788a47ac0ff2be11ae8fa926b5a5534156aa60e82c9afc71bfb842c419e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1035f4e7181d230cfc455cdfa2ce71f62d511b859134fae21661261e5793f0b09e03f16c4ce588f27ff9abb2d882013a1b677ea476c41f9b0e425abdb850a63e
|
7
|
+
data.tar.gz: 411ed1f50c74cc73f053146ece609452bf84a250d93a1874a33df0c0dc20088df06ee4446e8070be8d75dfad397b8437370794dc20f26763460fefda86490747
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
# v0.3.0
|
2
|
+
- OpenAPI v3 support
|
3
|
+
- classes Request/Response, OpenAPI::Operation, OpenAPI::Document handle a request. ResourceBase relies on these.
|
4
|
+
- extract SchemaInstanceBase and friends to gem JSI
|
5
|
+
|
1
6
|
# v0.2.3
|
2
7
|
- fix mutability of SchemaInstanceBase with #[]=; instance is modified in place
|
3
8
|
- add mutability to JSON::Node with #[]=
|
data/README.md
CHANGED
@@ -9,17 +9,19 @@ Note: The canonical location of this README is on [RubyDoc](http://rubydoc.info/
|
|
9
9
|
|
10
10
|
## Background
|
11
11
|
|
12
|
-
To start with, you need an OpenAPI
|
12
|
+
To start with, you need an OpenAPI (formerly known as Swagger) document describing a service you will be consuming. v2 and v3 are both supported[^1]. This document can be written by hand or sometimes generated from other existing sources. The creation of an OpenAPI document specifying your service is outside the scope of Scorpio. Here are several resources on OpenAPI:
|
13
13
|
|
14
14
|
- [OpenAPI Specification at Wikipedia](https://en.wikipedia.org/wiki/OpenAPI_Specification)
|
15
15
|
- [OpenAPI Initiative](https://www.openapis.org/) is the official web site for OpenAPI
|
16
16
|
- [OpenAPI Specification on GitHub](https://github.com/OAI/OpenAPI-Specification)
|
17
17
|
- [swagger.io](https://swagger.io/) API tooling
|
18
18
|
|
19
|
-
OpenAPI relies on the definition of schemas using the JSON schema specification, which can be learned about at
|
19
|
+
OpenAPI relies on the definition of schemas using the JSON schema specification, which can be learned about at https://json-schema.org/
|
20
20
|
|
21
21
|
Once you have the OpenAPI document describing the service you will consume, you can get started implementing the code that will interact with that service.
|
22
22
|
|
23
|
+
[^1] Certain features may be missing, but Scorpio tries to make workarounds easy. Issues and pull requests regarding missing functionality are welcome.
|
24
|
+
|
23
25
|
## Pet Store
|
24
26
|
|
25
27
|
Let's dive into some code, shall we? If you have learned about OpenAPI, you likely learned using the example of the Pet Store service. This README will use the same service. Its documentation is at http://petstore.swagger.io/ and its OpenAPI 2 specification is at http://petstore.swagger.io/v2/swagger.json (yaml version: http://petstore.swagger.io/v2/swagger.yaml )
|
data/lib/scorpio.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
require "scorpio/version"
|
2
|
+
require "jsi"
|
3
|
+
require "ur"
|
2
4
|
require "pathname"
|
3
5
|
require "pp"
|
4
|
-
require "api_hammer/ycomb"
|
5
|
-
require "scorpio/json-schema-fragments"
|
6
6
|
|
7
7
|
module Scorpio
|
8
8
|
def self.root
|
@@ -10,8 +10,6 @@ module Scorpio
|
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
-
require "scorpio/util"
|
14
|
-
|
15
13
|
module Scorpio
|
16
14
|
# generally put in code paths that are not expected to be valid control flow paths.
|
17
15
|
# rather a NotImplementedCorrectlyError. but that's too long.
|
@@ -29,7 +27,7 @@ module Scorpio
|
|
29
27
|
@status
|
30
28
|
end
|
31
29
|
end
|
32
|
-
attr_accessor :
|
30
|
+
attr_accessor :ur, :response_object
|
33
31
|
end
|
34
32
|
# HTTP Error classes' canonical names are like Scorpio::HTTPErrors::BadRequest400Error, but can
|
35
33
|
# be referred to like Scorpio::BadRequest400Error. this is just to avoid clutter in the Scorpio
|
@@ -82,21 +80,10 @@ module Scorpio
|
|
82
80
|
include HTTPErrors
|
83
81
|
error_classes_by_status.freeze
|
84
82
|
|
85
|
-
autoload :
|
86
|
-
autoload :
|
87
|
-
autoload :
|
88
|
-
autoload :
|
89
|
-
autoload :
|
90
|
-
autoload :
|
91
|
-
autoload :ResourceBase, 'scorpio/resource_base'
|
92
|
-
autoload :Schema, 'scorpio/schema'
|
93
|
-
autoload :SchemaInstanceBase, 'scorpio/schema_instance_base'
|
94
|
-
autoload :SchemaClasses, 'scorpio/schema_instance_base'
|
95
|
-
autoload :ObjectJSONCoder, 'scorpio/schema_instance_json_coder'
|
96
|
-
autoload :StructJSONCoder, 'scorpio/struct_json_coder'
|
97
|
-
autoload :SchemaInstanceJSONCoder,'scorpio/schema_instance_json_coder'
|
98
|
-
|
99
|
-
def self.class_for_schema(*a, &b)
|
100
|
-
SchemaClasses.class_for_schema(*a, &b)
|
101
|
-
end
|
83
|
+
autoload :Google, 'scorpio/google_api_document'
|
84
|
+
autoload :OpenAPI, 'scorpio/openapi'
|
85
|
+
autoload :Ur, 'scorpio/ur'
|
86
|
+
autoload :ResourceBase, 'scorpio/resource_base'
|
87
|
+
autoload :Request, 'scorpio/request'
|
88
|
+
autoload :Response, 'scorpio/response'
|
102
89
|
end
|
@@ -1,22 +1,19 @@
|
|
1
|
-
require 'api_hammer/ycomb'
|
2
|
-
require 'scorpio/schema_instance_base'
|
3
|
-
|
4
1
|
module Scorpio
|
5
2
|
module Google
|
6
|
-
discovery_rest_description_doc =
|
3
|
+
discovery_rest_description_doc = JSI::JSON::Node.new_by_type(::JSON.parse(Scorpio.root.join('documents/www.googleapis.com/discovery/v1/apis/discovery/v1/rest').read), [])
|
7
4
|
|
8
5
|
discovery_metaschema = discovery_rest_description_doc['schemas']['JsonSchema']
|
9
|
-
rest_description_schema =
|
10
|
-
discovery_rest_description =
|
6
|
+
rest_description_schema = JSI.class_for_schema(discovery_metaschema).new(discovery_rest_description_doc['schemas']['RestDescription'])
|
7
|
+
discovery_rest_description = JSI.class_for_schema(rest_description_schema).new(discovery_rest_description_doc)
|
11
8
|
|
12
9
|
# naming these is not strictly necessary, but is nice to have.
|
13
|
-
DirectoryList =
|
14
|
-
JsonSchema =
|
15
|
-
RestDescription =
|
16
|
-
RestMethod =
|
17
|
-
RestResource =
|
18
|
-
RestMethodRequest =
|
19
|
-
RestMethodResponse =
|
10
|
+
DirectoryList = JSI.class_for_schema(discovery_rest_description['schemas']['DirectoryList'])
|
11
|
+
JsonSchema = JSI.class_for_schema(discovery_rest_description['schemas']['JsonSchema'])
|
12
|
+
RestDescription = JSI.class_for_schema(discovery_rest_description['schemas']['RestDescription'])
|
13
|
+
RestMethod = JSI.class_for_schema(discovery_rest_description['schemas']['RestMethod'])
|
14
|
+
RestResource = JSI.class_for_schema(discovery_rest_description['schemas']['RestResource'])
|
15
|
+
RestMethodRequest = JSI.class_for_schema(discovery_rest_description['schemas']['RestMethod']['properties']['request'])
|
16
|
+
RestMethodResponse = JSI.class_for_schema(discovery_rest_description['schemas']['RestMethod']['properties']['response'])
|
20
17
|
|
21
18
|
# google does a weird thing where it defines a schema with a $ref property where a json-schema is to be used in the document (method request and response fields), instead of just setting the schema to be the json-schema schema. we'll share a module across those schema classes that really represent schemas. is this confusingly meta enough?
|
22
19
|
module SchemaLike
|
@@ -169,14 +166,14 @@ module Scorpio
|
|
169
166
|
if ad.schemas
|
170
167
|
openapi['definitions'] = ad.schemas
|
171
168
|
ad.schemas.each do |name, schema|
|
172
|
-
openapi = ycomb do |rec|
|
169
|
+
openapi = JSI::Util.ycomb do |rec|
|
173
170
|
proc do |object|
|
174
171
|
if object.respond_to?(:to_hash)
|
175
172
|
object.merge(object.map do |k, v|
|
176
173
|
if k == '$ref' && (v == schema['id'] || v == "#/schemas/#{name}" || v == name)
|
177
174
|
{k => "#/definitions/#{name}"}
|
178
175
|
else
|
179
|
-
ycomb do |toopenapirec|
|
176
|
+
JSI::Util.ycomb do |toopenapirec|
|
180
177
|
proc do |toopenapiobject|
|
181
178
|
toopenapiobject = toopenapiobject.to_openapi if toopenapiobject.respond_to?(:to_openapi)
|
182
179
|
if toopenapiobject.respond_to?(:to_hash)
|
@@ -204,7 +201,7 @@ module Scorpio
|
|
204
201
|
end
|
205
202
|
end
|
206
203
|
# check we haven't got anything that shouldn't go in a openapi document
|
207
|
-
openapi = ycomb do |rec|
|
204
|
+
openapi = JSI::Util.ycomb do |rec|
|
208
205
|
proc do |object|
|
209
206
|
object = object.to_openapi if object.respond_to?(:to_openapi)
|
210
207
|
if object.respond_to?(:to_hash)
|
data/lib/scorpio/openapi.rb
CHANGED
@@ -1,168 +1,166 @@
|
|
1
|
-
require 'scorpio/schema_instance_base'
|
2
|
-
|
3
1
|
module Scorpio
|
4
2
|
module OpenAPI
|
3
|
+
autoload :Operation, 'scorpio/openapi/operation'
|
4
|
+
autoload :Document, 'scorpio/openapi/document'
|
5
|
+
autoload :OperationsScope, 'scorpio/openapi/operations_scope'
|
6
|
+
|
5
7
|
module V3
|
6
|
-
openapi_schema =
|
8
|
+
openapi_schema = JSI::Schema.new(::JSON.parse(Scorpio.root.join('documents/openapis.org/v3/schema.json').read))
|
7
9
|
openapi_class = proc do |*key|
|
8
|
-
|
10
|
+
JSI.class_for_schema(key.inject(openapi_schema, &:[]))
|
9
11
|
end
|
10
12
|
|
11
13
|
Document = openapi_class.call()
|
12
14
|
|
13
15
|
# naming these is not strictly necessary, but is nice to have.
|
14
|
-
# generated: puts
|
15
|
-
Info
|
16
|
-
Contact
|
17
|
-
License
|
18
|
-
Server
|
19
|
-
ServerVariable
|
20
|
-
Components
|
21
|
-
Paths
|
22
|
-
PathItem
|
23
|
-
Operation
|
24
|
-
ExternalDocs
|
25
|
-
Parameter
|
26
|
-
RequestBody
|
27
|
-
MediaType
|
28
|
-
Encoding
|
29
|
-
Responses
|
30
|
-
Response
|
31
|
-
Callback
|
32
|
-
Example
|
33
|
-
Link
|
34
|
-
Header
|
35
|
-
Tag
|
36
|
-
Examples
|
37
|
-
Reference
|
38
|
-
Schema
|
39
|
-
Discriminator
|
40
|
-
Xml
|
41
|
-
SecurityScheme
|
42
|
-
OauthFlows
|
43
|
-
OauthFlow
|
44
|
-
SecurityRequirement
|
45
|
-
AnyOrExpression
|
46
|
-
CallbackOrReference
|
47
|
-
ExampleOrReference
|
48
|
-
HeaderOrReference
|
49
|
-
LinkOrReference
|
50
|
-
ParameterOrReference
|
51
|
-
RequestBodyOrReference
|
52
|
-
ResponseOrReference
|
53
|
-
SchemaOrReference
|
54
|
-
SecuritySchemeOrReference
|
55
|
-
AnysOrExpressions
|
56
|
-
CallbacksOrReferences
|
57
|
-
Encodings
|
58
|
-
ExamplesOrReferences
|
59
|
-
HeadersOrReferences
|
60
|
-
LinksOrReferences
|
61
|
-
MediaTypes
|
62
|
-
ParametersOrReferences
|
63
|
-
RequestBodiesOrReferences
|
64
|
-
ResponsesOrReferences
|
65
|
-
SchemasOrReferences
|
16
|
+
# generated: puts Scorpio::OpenAPI::V3::Document.schema['definitions'].select { |k,v| ['object', nil].include?(v['type']) }.keys.map { |k| "#{k[0].upcase}#{k[1..-1]} = openapi_class.call('definitions', '#{k}')" }
|
17
|
+
Info = openapi_class.call('definitions', 'info')
|
18
|
+
Contact = openapi_class.call('definitions', 'contact')
|
19
|
+
License = openapi_class.call('definitions', 'license')
|
20
|
+
Server = openapi_class.call('definitions', 'server')
|
21
|
+
ServerVariable = openapi_class.call('definitions', 'serverVariable')
|
22
|
+
Components = openapi_class.call('definitions', 'components')
|
23
|
+
Paths = openapi_class.call('definitions', 'paths')
|
24
|
+
PathItem = openapi_class.call('definitions', 'pathItem')
|
25
|
+
Operation = openapi_class.call('definitions', 'operation')
|
26
|
+
ExternalDocs = openapi_class.call('definitions', 'externalDocs')
|
27
|
+
Parameter = openapi_class.call('definitions', 'parameter')
|
28
|
+
RequestBody = openapi_class.call('definitions', 'requestBody')
|
29
|
+
MediaType = openapi_class.call('definitions', 'mediaType')
|
30
|
+
Encoding = openapi_class.call('definitions', 'encoding')
|
31
|
+
Responses = openapi_class.call('definitions', 'responses')
|
32
|
+
Response = openapi_class.call('definitions', 'response')
|
33
|
+
Callback = openapi_class.call('definitions', 'callback')
|
34
|
+
Example = openapi_class.call('definitions', 'example')
|
35
|
+
Link = openapi_class.call('definitions', 'link')
|
36
|
+
Header = openapi_class.call('definitions', 'header')
|
37
|
+
Tag = openapi_class.call('definitions', 'tag')
|
38
|
+
Examples = openapi_class.call('definitions', 'examples')
|
39
|
+
Reference = openapi_class.call('definitions', 'reference')
|
40
|
+
Schema = openapi_class.call('definitions', 'schema')
|
41
|
+
Discriminator = openapi_class.call('definitions', 'discriminator')
|
42
|
+
Xml = openapi_class.call('definitions', 'xml')
|
43
|
+
SecurityScheme = openapi_class.call('definitions', 'securityScheme')
|
44
|
+
OauthFlows = openapi_class.call('definitions', 'oauthFlows')
|
45
|
+
OauthFlow = openapi_class.call('definitions', 'oauthFlow')
|
46
|
+
SecurityRequirement = openapi_class.call('definitions', 'securityRequirement')
|
47
|
+
AnyOrExpression = openapi_class.call('definitions', 'anyOrExpression')
|
48
|
+
CallbackOrReference = openapi_class.call('definitions', 'callbackOrReference')
|
49
|
+
ExampleOrReference = openapi_class.call('definitions', 'exampleOrReference')
|
50
|
+
HeaderOrReference = openapi_class.call('definitions', 'headerOrReference')
|
51
|
+
LinkOrReference = openapi_class.call('definitions', 'linkOrReference')
|
52
|
+
ParameterOrReference = openapi_class.call('definitions', 'parameterOrReference')
|
53
|
+
RequestBodyOrReference = openapi_class.call('definitions', 'requestBodyOrReference')
|
54
|
+
ResponseOrReference = openapi_class.call('definitions', 'responseOrReference')
|
55
|
+
SchemaOrReference = openapi_class.call('definitions', 'schemaOrReference')
|
56
|
+
SecuritySchemeOrReference = openapi_class.call('definitions', 'securitySchemeOrReference')
|
57
|
+
AnysOrExpressions = openapi_class.call('definitions', 'anysOrExpressions')
|
58
|
+
CallbacksOrReferences = openapi_class.call('definitions', 'callbacksOrReferences')
|
59
|
+
Encodings = openapi_class.call('definitions', 'encodings')
|
60
|
+
ExamplesOrReferences = openapi_class.call('definitions', 'examplesOrReferences')
|
61
|
+
HeadersOrReferences = openapi_class.call('definitions', 'headersOrReferences')
|
62
|
+
LinksOrReferences = openapi_class.call('definitions', 'linksOrReferences')
|
63
|
+
MediaTypes = openapi_class.call('definitions', 'mediaTypes')
|
64
|
+
ParametersOrReferences = openapi_class.call('definitions', 'parametersOrReferences')
|
65
|
+
RequestBodiesOrReferences = openapi_class.call('definitions', 'requestBodiesOrReferences')
|
66
|
+
ResponsesOrReferences = openapi_class.call('definitions', 'responsesOrReferences')
|
67
|
+
SchemasOrReferences = openapi_class.call('definitions', 'schemasOrReferences')
|
66
68
|
SecuritySchemesOrReferences = openapi_class.call('definitions', 'securitySchemesOrReferences')
|
67
|
-
ServerVariables
|
68
|
-
Strings
|
69
|
-
Object
|
70
|
-
Any
|
71
|
-
Expression
|
72
|
-
SpecificationExtension
|
73
|
-
DefaultType
|
69
|
+
ServerVariables = openapi_class.call('definitions', 'serverVariables')
|
70
|
+
Strings = openapi_class.call('definitions', 'strings')
|
71
|
+
Object = openapi_class.call('definitions', 'object')
|
72
|
+
Any = openapi_class.call('definitions', 'any')
|
73
|
+
Expression = openapi_class.call('definitions', 'expression')
|
74
|
+
SpecificationExtension = openapi_class.call('definitions', 'specificationExtension')
|
75
|
+
DefaultType = openapi_class.call('definitions', 'defaultType')
|
74
76
|
end
|
75
77
|
module V2
|
76
|
-
openapi_schema =
|
78
|
+
openapi_schema = JSI::Schema.new(::JSON.parse(Scorpio.root.join('documents/swagger.io/v2/schema.json').read))
|
77
79
|
openapi_class = proc do |*key|
|
78
|
-
|
80
|
+
JSI.class_for_schema(key.inject(openapi_schema, &:[]))
|
79
81
|
end
|
80
82
|
|
81
83
|
Document = openapi_class.call()
|
82
84
|
|
83
85
|
# naming these is not strictly necessary, but is nice to have.
|
84
|
-
# generated: puts Scorpio::OpenAPI::V2::Document.
|
85
|
-
Info
|
86
|
-
Contact
|
87
|
-
License
|
88
|
-
Paths
|
89
|
-
Definitions
|
90
|
-
ParameterDefinitions
|
91
|
-
ResponseDefinitions
|
92
|
-
ExternalDocs
|
93
|
-
Examples
|
94
|
-
Operation
|
95
|
-
PathItem
|
96
|
-
Responses
|
97
|
-
ResponseValue
|
98
|
-
Response
|
99
|
-
Headers
|
100
|
-
Header
|
101
|
-
VendorExtension
|
102
|
-
BodyParameter
|
103
|
-
HeaderParameterSubSchema
|
104
|
-
QueryParameterSubSchema
|
105
|
-
FormDataParameterSubSchema
|
106
|
-
PathParameterSubSchema
|
107
|
-
NonBodyParameter
|
108
|
-
Parameter
|
109
|
-
Schema
|
110
|
-
FileSchema
|
111
|
-
PrimitivesItems
|
112
|
-
SecurityRequirement
|
113
|
-
Xml
|
114
|
-
Tag
|
115
|
-
SecurityDefinitions
|
86
|
+
# generated: puts Scorpio::OpenAPI::V2::Document.schema['definitions'].select { |k,v| ['object', nil].include?(v['type']) }.keys.map { |k| "#{k[0].upcase}#{k[1..-1]} = openapi_class.call('definitions', '#{k}')" }
|
87
|
+
Info = openapi_class.call('definitions', 'info')
|
88
|
+
Contact = openapi_class.call('definitions', 'contact')
|
89
|
+
License = openapi_class.call('definitions', 'license')
|
90
|
+
Paths = openapi_class.call('definitions', 'paths')
|
91
|
+
Definitions = openapi_class.call('definitions', 'definitions')
|
92
|
+
ParameterDefinitions = openapi_class.call('definitions', 'parameterDefinitions')
|
93
|
+
ResponseDefinitions = openapi_class.call('definitions', 'responseDefinitions')
|
94
|
+
ExternalDocs = openapi_class.call('definitions', 'externalDocs')
|
95
|
+
Examples = openapi_class.call('definitions', 'examples')
|
96
|
+
Operation = openapi_class.call('definitions', 'operation')
|
97
|
+
PathItem = openapi_class.call('definitions', 'pathItem')
|
98
|
+
Responses = openapi_class.call('definitions', 'responses')
|
99
|
+
ResponseValue = openapi_class.call('definitions', 'responseValue')
|
100
|
+
Response = openapi_class.call('definitions', 'response')
|
101
|
+
Headers = openapi_class.call('definitions', 'headers')
|
102
|
+
Header = openapi_class.call('definitions', 'header')
|
103
|
+
VendorExtension = openapi_class.call('definitions', 'vendorExtension')
|
104
|
+
BodyParameter = openapi_class.call('definitions', 'bodyParameter')
|
105
|
+
HeaderParameterSubSchema = openapi_class.call('definitions', 'headerParameterSubSchema')
|
106
|
+
QueryParameterSubSchema = openapi_class.call('definitions', 'queryParameterSubSchema')
|
107
|
+
FormDataParameterSubSchema = openapi_class.call('definitions', 'formDataParameterSubSchema')
|
108
|
+
PathParameterSubSchema = openapi_class.call('definitions', 'pathParameterSubSchema')
|
109
|
+
NonBodyParameter = openapi_class.call('definitions', 'nonBodyParameter')
|
110
|
+
Parameter = openapi_class.call('definitions', 'parameter')
|
111
|
+
Schema = openapi_class.call('definitions', 'schema')
|
112
|
+
FileSchema = openapi_class.call('definitions', 'fileSchema')
|
113
|
+
PrimitivesItems = openapi_class.call('definitions', 'primitivesItems')
|
114
|
+
SecurityRequirement = openapi_class.call('definitions', 'securityRequirement')
|
115
|
+
Xml = openapi_class.call('definitions', 'xml')
|
116
|
+
Tag = openapi_class.call('definitions', 'tag')
|
117
|
+
SecurityDefinitions = openapi_class.call('definitions', 'securityDefinitions')
|
116
118
|
BasicAuthenticationSecurity = openapi_class.call('definitions', 'basicAuthenticationSecurity')
|
117
|
-
ApiKeySecurity
|
118
|
-
Oauth2ImplicitSecurity
|
119
|
-
Oauth2PasswordSecurity
|
120
|
-
Oauth2ApplicationSecurity
|
121
|
-
Oauth2AccessCodeSecurity
|
122
|
-
Oauth2Scopes
|
123
|
-
Title
|
124
|
-
Description
|
125
|
-
Default
|
126
|
-
MultipleOf
|
127
|
-
Maximum
|
128
|
-
ExclusiveMaximum
|
129
|
-
Minimum
|
130
|
-
ExclusiveMinimum
|
131
|
-
MaxLength
|
132
|
-
MinLength
|
133
|
-
Pattern
|
134
|
-
MaxItems
|
135
|
-
MinItems
|
136
|
-
UniqueItems
|
137
|
-
Enum
|
138
|
-
JsonReference
|
119
|
+
ApiKeySecurity = openapi_class.call('definitions', 'apiKeySecurity')
|
120
|
+
Oauth2ImplicitSecurity = openapi_class.call('definitions', 'oauth2ImplicitSecurity')
|
121
|
+
Oauth2PasswordSecurity = openapi_class.call('definitions', 'oauth2PasswordSecurity')
|
122
|
+
Oauth2ApplicationSecurity = openapi_class.call('definitions', 'oauth2ApplicationSecurity')
|
123
|
+
Oauth2AccessCodeSecurity = openapi_class.call('definitions', 'oauth2AccessCodeSecurity')
|
124
|
+
Oauth2Scopes = openapi_class.call('definitions', 'oauth2Scopes')
|
125
|
+
Title = openapi_class.call('definitions', 'title')
|
126
|
+
Description = openapi_class.call('definitions', 'description')
|
127
|
+
Default = openapi_class.call('definitions', 'default')
|
128
|
+
MultipleOf = openapi_class.call('definitions', 'multipleOf')
|
129
|
+
Maximum = openapi_class.call('definitions', 'maximum')
|
130
|
+
ExclusiveMaximum = openapi_class.call('definitions', 'exclusiveMaximum')
|
131
|
+
Minimum = openapi_class.call('definitions', 'minimum')
|
132
|
+
ExclusiveMinimum = openapi_class.call('definitions', 'exclusiveMinimum')
|
133
|
+
MaxLength = openapi_class.call('definitions', 'maxLength')
|
134
|
+
MinLength = openapi_class.call('definitions', 'minLength')
|
135
|
+
Pattern = openapi_class.call('definitions', 'pattern')
|
136
|
+
MaxItems = openapi_class.call('definitions', 'maxItems')
|
137
|
+
MinItems = openapi_class.call('definitions', 'minItems')
|
138
|
+
UniqueItems = openapi_class.call('definitions', 'uniqueItems')
|
139
|
+
Enum = openapi_class.call('definitions', 'enum')
|
140
|
+
JsonReference = openapi_class.call('definitions', 'jsonReference')
|
141
|
+
end
|
139
142
|
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
@path ||= if parent.is_a?(Scorpio::OpenAPI::V2::PathItem) && parent.parent.is_a?(Scorpio::OpenAPI::V2::Paths)
|
145
|
-
parent.instance.path.last
|
146
|
-
end
|
147
|
-
end
|
148
|
-
def http_method
|
149
|
-
@http_method ||= if parent.is_a?(Scorpio::OpenAPI::V2::PathItem)
|
150
|
-
instance.path.last
|
151
|
-
end
|
152
|
-
end
|
143
|
+
begin
|
144
|
+
# the autoloads for OpenAPI::Operation and OpenAPI::Document
|
145
|
+
# should not be triggered until all the classes their files reference are defined (above)
|
146
|
+
end # (this block is here just so the above informative comment is not interpreted as module doc)
|
153
147
|
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
148
|
+
module V3
|
149
|
+
class Operation
|
150
|
+
include OpenAPI::Operation
|
151
|
+
end
|
152
|
+
class Document
|
153
|
+
include OpenAPI::Document
|
154
|
+
end
|
155
|
+
require 'scorpio/openapi/v3/server'
|
156
|
+
end
|
160
157
|
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
158
|
+
module V2
|
159
|
+
class Operation
|
160
|
+
include OpenAPI::Operation
|
161
|
+
end
|
162
|
+
class Document
|
163
|
+
include OpenAPI::Document
|
166
164
|
end
|
167
165
|
end
|
168
166
|
end
|