scorpio 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/scorpio/google_api_document.rb +3 -3
- data/lib/scorpio/openapi.rb +6 -6
- data/lib/scorpio/request.rb +1 -1
- data/lib/scorpio/resource_base.rb +2 -2
- data/lib/scorpio/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c63ccc2d793787385be12175b68b1aca1b68372ee72bae4cb78e434d931aa941
|
4
|
+
data.tar.gz: 3e9bec23f6ca7ad6905ca1fcd33ce185f1dd5741ad3a1097d0cbc82fea09fef1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c7f265f3e6f68c340a2720a1f09238cd0f95d4a1dcfa8fb225ad4afa6e211fbe715c337d37faf7d8037ab0267b142af523182cf1d7eecca4e4cd80af16956a54
|
7
|
+
data.tar.gz: 0a3601a2380269a73fde895e1a2d9c80617a2643ead58420866baa04f5d4a2bad5ce06c54b43f155283f53286b2c1bca09b527b2f7d494d9b766e9a188ae31b6
|
data/CHANGELOG.md
CHANGED
@@ -29,7 +29,7 @@ module Scorpio
|
|
29
29
|
# 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?
|
30
30
|
module SchemaLike
|
31
31
|
def to_openapi
|
32
|
-
dup_doc = JSI::
|
32
|
+
dup_doc = JSI::Util.as_json(self)
|
33
33
|
# openapi does not want an id field on schemas
|
34
34
|
dup_doc.delete('id')
|
35
35
|
if dup_doc['properties'].is_a?(Hash)
|
@@ -56,7 +56,7 @@ module Scorpio
|
|
56
56
|
|
57
57
|
def to_openapi_hash(options = {})
|
58
58
|
# we will be modifying the api document (RestDescription). clone self and modify that one.
|
59
|
-
ad = self.class.new(JSI::
|
59
|
+
ad = self.class.new(JSI::Util.as_json(self))
|
60
60
|
ad_methods = []
|
61
61
|
if ad['methods']
|
62
62
|
ad_methods += ad['methods'].map do |mn, m|
|
@@ -212,7 +212,7 @@ module Scorpio
|
|
212
212
|
end.call(openapi)
|
213
213
|
end
|
214
214
|
end
|
215
|
-
JSI::
|
215
|
+
JSI::Util.as_json(openapi)
|
216
216
|
end
|
217
217
|
end
|
218
218
|
end
|
data/lib/scorpio/openapi.rb
CHANGED
@@ -25,8 +25,8 @@ module Scorpio
|
|
25
25
|
'documents/github.com/OAI/OpenAPI-Specification/blob/oas3-schema/schemas/v3.0/schema.yaml'
|
26
26
|
)))
|
27
27
|
|
28
|
-
# the schema represented by Scorpio::OpenAPI::V3::Schema will describe schemas itself
|
29
|
-
#
|
28
|
+
# the schema represented by Scorpio::OpenAPI::V3::Schema will describe schemas itself.
|
29
|
+
# JSI::Schema#describes_schema! enables this to implement the functionality of schemas.
|
30
30
|
describe_schema = [
|
31
31
|
openapi_document_schema.definitions['Schema'],
|
32
32
|
openapi_document_schema.definitions['SchemaReference'],
|
@@ -40,7 +40,7 @@ module Scorpio
|
|
40
40
|
# a problem, and this way also applies when none of the anyOf match due to schema errors.)
|
41
41
|
openapi_document_schema.definitions['Schema'].properties['additionalProperties'],
|
42
42
|
]
|
43
|
-
describe_schema.each { |s| s.
|
43
|
+
describe_schema.each { |s| s.describes_schema!([JSI::Schema::Draft04]) }
|
44
44
|
|
45
45
|
Document = openapi_document_schema.jsi_schema_module
|
46
46
|
|
@@ -118,14 +118,14 @@ module Scorpio
|
|
118
118
|
'documents/swagger.io/v2/schema.json'
|
119
119
|
).read))
|
120
120
|
|
121
|
-
# the schema represented by Scorpio::OpenAPI::V2::Schema will describe schemas itself
|
122
|
-
#
|
121
|
+
# the schema represented by Scorpio::OpenAPI::V2::Schema will describe schemas itself.
|
122
|
+
# JSI::Schema#describes_schema! enables this to implement the functionality of schemas.
|
123
123
|
describe_schema = [
|
124
124
|
openapi_document_schema.definitions['schema'],
|
125
125
|
# comments above on v3's definitions['Schema'].properties['additionalProperties'] apply here too
|
126
126
|
openapi_document_schema.definitions['schema'].properties['additionalProperties'],
|
127
127
|
]
|
128
|
-
describe_schema.each { |s| s.
|
128
|
+
describe_schema.each { |s| s.describes_schema!([JSI::Schema::Draft04]) }
|
129
129
|
|
130
130
|
Document = openapi_document_schema.jsi_schema_module
|
131
131
|
|
data/lib/scorpio/request.rb
CHANGED
@@ -71,7 +71,7 @@ module Scorpio
|
|
71
71
|
return @body if instance_variable_defined?(:@body)
|
72
72
|
if instance_variable_defined?(:@body_object)
|
73
73
|
if content_type && content_type.json?
|
74
|
-
JSON.pretty_generate(JSI::
|
74
|
+
JSON.pretty_generate(JSI::Util.as_json(body_object))
|
75
75
|
elsif content_type && content_type.form_urlencoded?
|
76
76
|
URI.encode_www_form(body_object)
|
77
77
|
|
@@ -324,7 +324,7 @@ module Scorpio
|
|
324
324
|
else
|
325
325
|
jsi = operation.request_schema.new_jsi(o)
|
326
326
|
end
|
327
|
-
jsi.
|
327
|
+
jsi.jsi_select_descendents_leaf_first do |node|
|
328
328
|
# we want to specifically reject only nodes described (only) by a false schema.
|
329
329
|
# note that for OpenAPI schemas, false is only a valid schema as a value
|
330
330
|
# of `additionalProperties`
|
@@ -418,7 +418,7 @@ module Scorpio
|
|
418
418
|
end
|
419
419
|
|
420
420
|
def as_json(*opt)
|
421
|
-
JSI::
|
421
|
+
JSI::Util.as_json(contained_object, *opt)
|
422
422
|
end
|
423
423
|
|
424
424
|
def inspect
|
data/lib/scorpio/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scorpio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ethan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-01-
|
11
|
+
date: 2023-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jsi
|