scorpio 0.6.4 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.yardopts +6 -1
- data/CHANGELOG.md +10 -2
- data/LICENSE.md +2 -4
- data/README.md +81 -67
- data/documents/{github.com/OAI/OpenAPI-Specification/blob/oas3-schema/schemas/v3.0 → spec.openapis.org/oas/3.0}/schema.yaml +164 -628
- data/documents/spec.openapis.org/oas/3.1/dialect/base.schema.yaml +22 -0
- data/documents/spec.openapis.org/oas/3.1/meta/base.schema.yaml +71 -0
- data/documents/spec.openapis.org/oas/3.1/schema-base.yaml +21 -0
- data/documents/spec.openapis.org/oas/3.1/schema.yaml +980 -0
- data/documents/swagger.io/v2/schema.json +1 -1
- data/documents/www.googleapis.com/discovery/v1/apis/discovery/v1/rest.yml +44 -4
- data/lib/scorpio/google_api_document.rb +121 -193
- data/lib/scorpio/openapi/document.rb +63 -31
- data/lib/scorpio/openapi/operation.rb +114 -96
- data/lib/scorpio/openapi/operations_scope.rb +35 -19
- data/lib/scorpio/openapi/reference.rb +88 -23
- data/lib/scorpio/openapi/schema_elements/type_nullable.rb +38 -0
- data/lib/scorpio/openapi/schema_elements.rb +7 -0
- data/lib/scorpio/openapi/server.rb +34 -0
- data/lib/scorpio/openapi/tag.rb +19 -3
- data/lib/scorpio/openapi/v2/dialect.rb +66 -0
- data/lib/scorpio/openapi/v2.rb +124 -0
- data/lib/scorpio/openapi/v3_0/dialect.rb +76 -0
- data/lib/scorpio/openapi/v3_0.rb +130 -0
- data/lib/scorpio/openapi/v3_1.rb +243 -0
- data/lib/scorpio/openapi.rb +23 -203
- data/lib/scorpio/request.rb +67 -61
- data/lib/scorpio/resource_base.rb +57 -49
- data/lib/scorpio/response.rb +28 -10
- data/lib/scorpio/ur.rb +7 -3
- data/lib/scorpio/version.rb +1 -1
- data/lib/scorpio.rb +12 -6
- data/pages/Request_Configuration.md +69 -0
- data/pages/Security.md +50 -0
- data/scorpio.gemspec +6 -5
- metadata +28 -15
- data/documents/www.googleapis.com/discovery/v1/apis/discovery/v1/rest +0 -684
- data/lib/scorpio/openapi/v3/server.rb +0 -44
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Scorpio
|
|
4
|
-
module OpenAPI
|
|
5
|
-
module V3
|
|
6
|
-
raise(Bug, 'const_defined? Scorpio::OpenAPI::V3::Server') unless const_defined?(:Server)
|
|
7
|
-
|
|
8
|
-
# An object representing a Server.
|
|
9
|
-
#
|
|
10
|
-
# https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.2.md#serverObject
|
|
11
|
-
module Server
|
|
12
|
-
# expands this server's #url using the given_server_variables. any variables
|
|
13
|
-
# that are in the url but not in the given server variables are filled in
|
|
14
|
-
# using the default value for the variable.
|
|
15
|
-
#
|
|
16
|
-
# @param given_server_variables [Hash<String, String>]
|
|
17
|
-
# @return [Addressable::URI] the expanded url
|
|
18
|
-
def expanded_url(given_server_variables)
|
|
19
|
-
if variables
|
|
20
|
-
server_variables = (given_server_variables.keys | variables.keys).map do |key|
|
|
21
|
-
server_variable = variables[key]
|
|
22
|
-
if server_variable && server_variable.enum
|
|
23
|
-
unless server_variable.enum.include?(given_server_variables[key])
|
|
24
|
-
warn # TODO BLAME
|
|
25
|
-
end
|
|
26
|
-
end
|
|
27
|
-
if given_server_variables.key?(key)
|
|
28
|
-
{key => given_server_variables[key]}
|
|
29
|
-
elsif server_variable.key?('default')
|
|
30
|
-
{key => server_variable.default}
|
|
31
|
-
else
|
|
32
|
-
{}
|
|
33
|
-
end
|
|
34
|
-
end.inject({}, &:update)
|
|
35
|
-
else
|
|
36
|
-
server_variables = given_server_variables
|
|
37
|
-
end
|
|
38
|
-
template = Addressable::Template.new(url)
|
|
39
|
-
template.expand(server_variables).freeze
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
end
|
|
44
|
-
end
|