jsapi 2.1.2 → 3.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/lib/jsapi/client/base.rb +182 -0
- data/lib/jsapi/client/exceptions.rb +45 -0
- data/lib/jsapi/client/request.rb +204 -0
- data/lib/jsapi/client/response.rb +120 -0
- data/lib/jsapi/client/session/base.rb +61 -0
- data/lib/jsapi/client/session/logger.rb +52 -0
- data/lib/jsapi/client/session/single_request.rb +16 -0
- data/lib/jsapi/client/session/test/class_methods.rb +49 -0
- data/lib/jsapi/client/session/test/response.rb +56 -0
- data/lib/jsapi/client/session/test/spy.rb +43 -0
- data/lib/jsapi/client/session/test.rb +17 -0
- data/lib/jsapi/client/session.rb +6 -0
- data/lib/jsapi/client.rb +7 -0
- data/lib/jsapi/configuration.rb +2 -2
- data/lib/jsapi/controller/authentication/credentials/http/bearer.rb +5 -12
- data/lib/jsapi/controller/authentication/credentials.rb +4 -4
- data/lib/jsapi/controller/authentication.rb +3 -3
- data/lib/jsapi/controller/methods.rb +43 -77
- data/lib/jsapi/controller/parameters.rb +6 -6
- data/lib/jsapi/controller/response.rb +7 -7
- data/lib/jsapi/{meta/definitions.rb → definition/api.rb} +62 -40
- data/lib/jsapi/{meta → definition}/callable/symbol_evaluator.rb +1 -1
- data/lib/jsapi/{meta → definition}/callable/symbol_sequence_evaluator.rb +1 -1
- data/lib/jsapi/{meta → definition}/callable.rb +1 -1
- data/lib/jsapi/{meta → definition}/callback/base.rb +5 -5
- data/lib/jsapi/{meta → definition}/callback/reference.rb +1 -1
- data/lib/jsapi/{meta → definition}/callback.rb +1 -1
- data/lib/jsapi/{meta → definition}/contact.rb +1 -1
- data/lib/jsapi/{meta → definition}/content.rb +11 -11
- data/lib/jsapi/{meta → definition}/defaults.rb +1 -1
- data/lib/jsapi/{meta → definition}/example/base.rb +1 -1
- data/lib/jsapi/{meta → definition}/example/builder.rb +4 -4
- data/lib/jsapi/{meta → definition}/example/reference.rb +1 -1
- data/lib/jsapi/{meta → definition}/example.rb +1 -1
- data/lib/jsapi/{meta → definition}/existence.rb +1 -1
- data/lib/jsapi/{meta → definition}/external_documentation.rb +1 -1
- data/lib/jsapi/{meta → definition}/header/base.rb +1 -1
- data/lib/jsapi/{meta → definition}/header/reference.rb +1 -1
- data/lib/jsapi/{meta → definition}/header.rb +1 -1
- data/lib/jsapi/{meta → definition}/info.rb +1 -1
- data/lib/jsapi/{meta → definition}/license.rb +1 -1
- data/lib/jsapi/{meta → definition}/link/base.rb +1 -1
- data/lib/jsapi/{meta → definition}/link/reference.rb +1 -1
- data/lib/jsapi/{meta → definition}/link.rb +1 -1
- data/lib/jsapi/{meta → definition}/model/attributes/class_methods.rb +1 -1
- data/lib/jsapi/{meta → definition}/model/attributes/frozen_error.rb +1 -1
- data/lib/jsapi/{meta → definition}/model/attributes/type_caster.rb +2 -2
- data/lib/jsapi/{meta → definition}/model/attributes.rb +1 -1
- data/lib/jsapi/{meta → definition}/model/base.rb +1 -1
- data/lib/jsapi/{meta → definition}/model/reference.rb +11 -11
- data/lib/jsapi/{meta → definition}/model/wrappable.rb +3 -3
- data/lib/jsapi/{meta → definition}/model/wrapper.rb +5 -5
- data/lib/jsapi/{meta → definition}/oauth_flow.rb +1 -1
- data/lib/jsapi/{meta → definition}/openapi/extensions.rb +1 -1
- data/lib/jsapi/{meta → definition}/openapi/path_item.rb +5 -5
- data/lib/jsapi/{meta → definition}/openapi/version.rb +2 -2
- data/lib/jsapi/{meta → definition}/openapi.rb +1 -1
- data/lib/jsapi/{meta → definition}/operation.rb +108 -62
- data/lib/jsapi/{meta → definition}/parameter/base.rb +11 -11
- data/lib/jsapi/{meta → definition}/parameter/reference.rb +5 -5
- data/lib/jsapi/{meta → definition}/parameter/wrapper.rb +2 -2
- data/lib/jsapi/{meta → definition}/parameter.rb +1 -1
- data/lib/jsapi/{meta → definition}/path.rb +1 -1
- data/lib/jsapi/{meta → definition}/pathname.rb +1 -1
- data/lib/jsapi/{meta → definition}/property.rb +2 -2
- data/lib/jsapi/{meta → definition}/reference_error.rb +1 -1
- data/lib/jsapi/{meta → definition}/request_body/base.rb +1 -1
- data/lib/jsapi/{meta → definition}/request_body/reference.rb +1 -1
- data/lib/jsapi/{meta → definition}/request_body/wrapper.rb +2 -2
- data/lib/jsapi/{meta → definition}/request_body.rb +1 -1
- data/lib/jsapi/{meta → definition}/rescue_handler.rb +1 -1
- data/lib/jsapi/{meta → definition}/response/base.rb +4 -4
- data/lib/jsapi/{meta → definition}/response/reference.rb +1 -1
- data/lib/jsapi/{meta → definition}/response/wrapper.rb +17 -5
- data/lib/jsapi/{meta → definition}/response.rb +1 -1
- data/lib/jsapi/{meta → definition}/schema/additional_properties.rb +2 -2
- data/lib/jsapi/{meta → definition}/schema/array.rb +2 -2
- data/lib/jsapi/{meta → definition}/schema/base.rb +1 -1
- data/lib/jsapi/{meta → definition}/schema/boolean.rb +1 -1
- data/lib/jsapi/{meta → definition}/schema/boundary.rb +1 -1
- data/lib/jsapi/{meta → definition}/schema/conversion.rb +1 -1
- data/lib/jsapi/{meta → definition}/schema/discriminator.rb +1 -1
- data/lib/jsapi/{meta → definition}/schema/integer.rb +1 -1
- data/lib/jsapi/{meta → definition}/schema/number.rb +1 -1
- data/lib/jsapi/{meta → definition}/schema/numeric.rb +1 -1
- data/lib/jsapi/{meta → definition}/schema/object.rb +13 -13
- data/lib/jsapi/{meta → definition}/schema/reference.rb +1 -1
- data/lib/jsapi/{meta → definition}/schema/string.rb +1 -1
- data/lib/jsapi/{meta → definition}/schema/validation/base.rb +1 -1
- data/lib/jsapi/{meta → definition}/schema/validation/enum.rb +1 -1
- data/lib/jsapi/{meta → definition}/schema/validation/max_items.rb +1 -1
- data/lib/jsapi/{meta → definition}/schema/validation/max_length.rb +1 -1
- data/lib/jsapi/{meta → definition}/schema/validation/maximum.rb +1 -1
- data/lib/jsapi/{meta → definition}/schema/validation/min_items.rb +1 -1
- data/lib/jsapi/{meta → definition}/schema/validation/min_length.rb +1 -1
- data/lib/jsapi/{meta → definition}/schema/validation/minimum.rb +1 -1
- data/lib/jsapi/{meta → definition}/schema/validation/multiple_of.rb +1 -1
- data/lib/jsapi/{meta → definition}/schema/validation/pattern.rb +1 -1
- data/lib/jsapi/{meta → definition}/schema/wrapper.rb +18 -4
- data/lib/jsapi/{meta → definition}/schema.rb +5 -5
- data/lib/jsapi/{meta → definition}/security_requirement.rb +1 -1
- data/lib/jsapi/{meta → definition}/security_scheme/api_key.rb +1 -1
- data/lib/jsapi/{meta → definition}/security_scheme/base.rb +1 -1
- data/lib/jsapi/{meta → definition}/security_scheme/http/basic.rb +1 -1
- data/lib/jsapi/{meta → definition}/security_scheme/http/bearer.rb +1 -1
- data/lib/jsapi/{meta → definition}/security_scheme/http/other.rb +1 -1
- data/lib/jsapi/{meta → definition}/security_scheme/http.rb +1 -1
- data/lib/jsapi/{meta → definition}/security_scheme/mutual_tls.rb +1 -1
- data/lib/jsapi/{meta → definition}/security_scheme/oauth2.rb +1 -1
- data/lib/jsapi/{meta → definition}/security_scheme/open_id_connect.rb +1 -1
- data/lib/jsapi/{meta → definition}/security_scheme.rb +1 -1
- data/lib/jsapi/{meta → definition}/server.rb +24 -1
- data/lib/jsapi/{meta → definition}/server_variable.rb +1 -1
- data/lib/jsapi/{meta → definition}/tag.rb +1 -1
- data/lib/jsapi/definition.rb +33 -0
- data/lib/jsapi/dsl/{definitions.rb → api.rb} +48 -48
- data/lib/jsapi/dsl/base.rb +7 -7
- data/lib/jsapi/dsl/class_methods.rb +34 -32
- data/lib/jsapi/dsl/examples.rb +1 -1
- data/lib/jsapi/dsl/operation.rb +9 -7
- data/lib/jsapi/dsl/parameter.rb +1 -1
- data/lib/jsapi/dsl/path.rb +8 -6
- data/lib/jsapi/dsl/response.rb +5 -5
- data/lib/jsapi/dsl/schema.rb +17 -17
- data/lib/jsapi/dsl/shared_operation_methods.rb +11 -26
- data/lib/jsapi/dsl.rb +2 -2
- data/lib/jsapi/model/errors.rb +3 -3
- data/lib/jsapi/status/code.rb +20 -0
- data/lib/jsapi/support/messages.rb +27 -0
- data/lib/jsapi/support.rb +3 -0
- data/lib/jsapi/version.rb +1 -1
- data/lib/jsapi.rb +3 -3
- metadata +115 -102
- data/lib/jsapi/jsonify_error.rb +0 -17
- data/lib/jsapi/messages.rb +0 -19
- data/lib/jsapi/meta.rb +0 -38
- /data/lib/jsapi/{meta → definition}/model.rb +0 -0
- /data/lib/jsapi/{meta → definition}/schema/validation.rb +0 -0
data/lib/jsapi/dsl/schema.rb
CHANGED
|
@@ -12,12 +12,12 @@ module Jsapi
|
|
|
12
12
|
#
|
|
13
13
|
# additional_properties type: 'string'
|
|
14
14
|
#
|
|
15
|
-
# See
|
|
15
|
+
# See Definition::Schema::Object#additional_properties for further information.
|
|
16
16
|
|
|
17
17
|
# Includes all of the properties from +schemas+. Each argument must be the name of
|
|
18
18
|
# a schema defined by ClassMethods#api_schema or Definitions#schema.
|
|
19
19
|
def all_of(*schemas)
|
|
20
|
-
schemas.each { |schema| @
|
|
20
|
+
schemas.each { |schema| @definition.add_all_of({ ref: schema }) }
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
##
|
|
@@ -61,13 +61,13 @@ module Jsapi
|
|
|
61
61
|
# :args: **keywords, &block
|
|
62
62
|
# Specifies the external documentation.
|
|
63
63
|
#
|
|
64
|
-
# See
|
|
64
|
+
# See Definition::Schema::Base#external_docs for further information.
|
|
65
65
|
|
|
66
66
|
# Adds a sample matching the schema.
|
|
67
67
|
#
|
|
68
68
|
# example 'foo'
|
|
69
69
|
def example(example)
|
|
70
|
-
@
|
|
70
|
+
@definition.add_example(example)
|
|
71
71
|
end
|
|
72
72
|
|
|
73
73
|
##
|
|
@@ -77,7 +77,7 @@ module Jsapi
|
|
|
77
77
|
#
|
|
78
78
|
# existence :allow_nil
|
|
79
79
|
#
|
|
80
|
-
# See
|
|
80
|
+
# See Definition::Schema::Base#existence for further information.
|
|
81
81
|
|
|
82
82
|
# Specifies the format of a string.
|
|
83
83
|
#
|
|
@@ -85,7 +85,7 @@ module Jsapi
|
|
|
85
85
|
#
|
|
86
86
|
# Raises an Error if type is other than <code>"string"</code>.
|
|
87
87
|
#
|
|
88
|
-
# See
|
|
88
|
+
# See Definition::Schema::String#format for further information.
|
|
89
89
|
def format(format)
|
|
90
90
|
keyword(:format, format)
|
|
91
91
|
end
|
|
@@ -98,14 +98,14 @@ module Jsapi
|
|
|
98
98
|
#
|
|
99
99
|
# Raises an Error if type is other than <code>"array"</code>.
|
|
100
100
|
def items(**keywords, &block)
|
|
101
|
-
unless @
|
|
102
|
-
raise Error, "items isn't supported for '#{@
|
|
101
|
+
unless @definition.respond_to?(:items=)
|
|
102
|
+
raise Error, "items isn't supported for '#{@definition.type}'"
|
|
103
103
|
end
|
|
104
104
|
|
|
105
105
|
define do
|
|
106
|
-
@
|
|
106
|
+
@definition.items = keywords
|
|
107
107
|
|
|
108
|
-
@
|
|
108
|
+
@definition.items.tap do |items|
|
|
109
109
|
Schema.new(items, &block) if block
|
|
110
110
|
end
|
|
111
111
|
end
|
|
@@ -174,15 +174,15 @@ module Jsapi
|
|
|
174
174
|
#
|
|
175
175
|
# Raises an Error if type is other than <code>"object"</code>.
|
|
176
176
|
def model(klass = nil, &block)
|
|
177
|
-
unless @
|
|
178
|
-
raise Error, "model isn't supported for '#{@
|
|
177
|
+
unless @definition.respond_to?(:model=)
|
|
178
|
+
raise Error, "model isn't supported for '#{@definition.type}'"
|
|
179
179
|
end
|
|
180
180
|
|
|
181
181
|
if block
|
|
182
182
|
klass = Class.new(klass || Model::Base)
|
|
183
183
|
klass.class_eval(&block)
|
|
184
184
|
end
|
|
185
|
-
@
|
|
185
|
+
@definition.model = klass
|
|
186
186
|
end
|
|
187
187
|
|
|
188
188
|
##
|
|
@@ -210,12 +210,12 @@ module Jsapi
|
|
|
210
210
|
# Raises an Error if type is other than <code>"object"</code>.
|
|
211
211
|
def property(name, **keywords, &block)
|
|
212
212
|
define('property', name.inspect) do
|
|
213
|
-
unless @
|
|
214
|
-
raise Error, "property isn't supported for '#{@
|
|
213
|
+
unless @definition.respond_to?(:add_property)
|
|
214
|
+
raise Error, "property isn't supported for '#{@definition.type}'"
|
|
215
215
|
end
|
|
216
216
|
|
|
217
|
-
@
|
|
218
|
-
Schema.new(
|
|
217
|
+
@definition.add_property(name, keywords).tap do |property_definition|
|
|
218
|
+
Schema.new(property_definition, &block) if block
|
|
219
219
|
end
|
|
220
220
|
end
|
|
221
221
|
end
|
|
@@ -14,13 +14,13 @@ module Jsapi
|
|
|
14
14
|
# +klass+ can be any subclass of Model::Base. If block is given, an anonymous
|
|
15
15
|
# class is created that inherits either from +klass+ or Model::Base.
|
|
16
16
|
#
|
|
17
|
-
# See
|
|
17
|
+
# See Definition::Operation#model and Definition::Path#model for further information.
|
|
18
18
|
def model(klass = nil, &block)
|
|
19
19
|
if block
|
|
20
20
|
klass = Class.new(klass || Model::Base)
|
|
21
21
|
klass.class_eval(&block)
|
|
22
22
|
end
|
|
23
|
-
@
|
|
23
|
+
@definition.model = klass
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
# Specifies a parameter.
|
|
@@ -40,15 +40,15 @@ module Jsapi
|
|
|
40
40
|
#
|
|
41
41
|
# parameter 'foo'
|
|
42
42
|
#
|
|
43
|
-
# See
|
|
43
|
+
# See Definition::Operation#parameters and Definition::Path#parameters for further
|
|
44
44
|
# information.
|
|
45
45
|
def parameter(name = nil, **keywords, &block)
|
|
46
46
|
define('parameter', name&.inspect) do
|
|
47
47
|
name = keywords[:ref] if name.nil?
|
|
48
48
|
keywords = { ref: name } unless keywords.any? || block
|
|
49
49
|
|
|
50
|
-
@
|
|
51
|
-
Parameter.new(
|
|
50
|
+
@definition.add_parameter(name, keywords).tap do |parameter_definition|
|
|
51
|
+
Parameter.new(parameter_definition, &block) if block
|
|
52
52
|
end
|
|
53
53
|
end
|
|
54
54
|
end
|
|
@@ -73,7 +73,7 @@ module Jsapi
|
|
|
73
73
|
#
|
|
74
74
|
# request_body 'foo'
|
|
75
75
|
#
|
|
76
|
-
# See
|
|
76
|
+
# See Definition::Operation#request_body and Definition::Path#request_body for
|
|
77
77
|
# further information.
|
|
78
78
|
def request_body(name = nil, **keywords, &block)
|
|
79
79
|
define('request body') do
|
|
@@ -81,17 +81,9 @@ module Jsapi
|
|
|
81
81
|
if name && (keywords.any? || block)
|
|
82
82
|
|
|
83
83
|
keywords = { ref: name } if name
|
|
84
|
+
@definition.request_body = keywords
|
|
84
85
|
|
|
85
|
-
|
|
86
|
-
deprecation_warning(
|
|
87
|
-
'Starting with Jsapi 3.0, a `request_body` without :type will no longer ' \
|
|
88
|
-
'define an :object schema. Please specify `type: :object` explicitly.'
|
|
89
|
-
)
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
@meta_model.request_body = keywords
|
|
93
|
-
|
|
94
|
-
@meta_model.request_body.tap do |request_body|
|
|
86
|
+
@definition.request_body.tap do |request_body|
|
|
95
87
|
RequestBody.new(request_body, &block) if block
|
|
96
88
|
end
|
|
97
89
|
end
|
|
@@ -120,7 +112,7 @@ module Jsapi
|
|
|
120
112
|
#
|
|
121
113
|
# response 'foo'
|
|
122
114
|
#
|
|
123
|
-
# See
|
|
115
|
+
# See Definition::Operation#responses and Definition::Path#responses for further
|
|
124
116
|
# information.
|
|
125
117
|
def response(status = nil, name = nil, **keywords, &block)
|
|
126
118
|
define('response', status&.inspect) do
|
|
@@ -131,15 +123,8 @@ module Jsapi
|
|
|
131
123
|
raise Error, "name can't be specified together with keywords or a block"
|
|
132
124
|
end
|
|
133
125
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
'Starting with Jsapi 3.0, a `response` without :type will no longer ' \
|
|
137
|
-
'define an :object schema. Please specify `type: :object` explicitly.'
|
|
138
|
-
)
|
|
139
|
-
end
|
|
140
|
-
|
|
141
|
-
@meta_model.add_response(status, keywords).tap do |response_model|
|
|
142
|
-
Response.new(response_model, &block) if block
|
|
126
|
+
@definition.add_response(status, keywords).tap do |response_definition|
|
|
127
|
+
Response.new(response_definition, &block) if block
|
|
143
128
|
end
|
|
144
129
|
end
|
|
145
130
|
end
|
data/lib/jsapi/dsl.rb
CHANGED
|
@@ -9,11 +9,11 @@ require_relative 'dsl/response'
|
|
|
9
9
|
require_relative 'dsl/shared_operation_methods'
|
|
10
10
|
require_relative 'dsl/operation'
|
|
11
11
|
require_relative 'dsl/path'
|
|
12
|
-
require_relative 'dsl/
|
|
12
|
+
require_relative 'dsl/api'
|
|
13
13
|
require_relative 'dsl/class_methods'
|
|
14
14
|
|
|
15
15
|
module Jsapi
|
|
16
|
-
# The \DSL to define API components.
|
|
16
|
+
# The \DSL to define \API components.
|
|
17
17
|
module DSL
|
|
18
18
|
def self.included(base) # :nodoc:
|
|
19
19
|
base.extend(ClassMethods)
|
data/lib/jsapi/model/errors.rb
CHANGED
|
@@ -27,10 +27,10 @@ module Jsapi
|
|
|
27
27
|
errors << wrap(error)
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
-
# Calls
|
|
31
|
-
def nested(attribute
|
|
30
|
+
# Calls block in context of +attribute+.
|
|
31
|
+
def nested(attribute)
|
|
32
32
|
@path.push(attribute.to_sym)
|
|
33
|
-
|
|
33
|
+
yield if block_given?
|
|
34
34
|
ensure
|
|
35
35
|
@path.pop
|
|
36
36
|
end
|
data/lib/jsapi/status/code.rb
CHANGED
|
@@ -104,6 +104,26 @@ module Jsapi
|
|
|
104
104
|
super(value, priority: 1)
|
|
105
105
|
end
|
|
106
106
|
|
|
107
|
+
def informational?
|
|
108
|
+
Range::INFORMATIONAL.match?(self)
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
def success?
|
|
112
|
+
Range::SUCCESS.match?(self)
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def redirection?
|
|
116
|
+
Range::REDIRECTION.match?(self)
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
def client_error?
|
|
120
|
+
Range::CLIENT_ERROR.match?(self)
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
def server_error?
|
|
124
|
+
Range::SERVER_ERROR.match?(self)
|
|
125
|
+
end
|
|
126
|
+
|
|
107
127
|
# Returns true if and only if +status_code+ is equal to itself.
|
|
108
128
|
def match?(status_code)
|
|
109
129
|
status_code == self
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Jsapi
|
|
4
|
+
module Support
|
|
5
|
+
module Messages # :nodoc:
|
|
6
|
+
class << self
|
|
7
|
+
def invalid_value(name:, value:, valid_values: [])
|
|
8
|
+
case valid_values.count
|
|
9
|
+
when 0
|
|
10
|
+
"#{name} must not be #{value.inspect}"
|
|
11
|
+
when 1
|
|
12
|
+
"#{name} must be #{valid_values.first.inspect}, is #{value.inspect}"
|
|
13
|
+
else
|
|
14
|
+
"#{name} must be one of #{valid_values[0..-2].map(&:inspect).join(', ')} " \
|
|
15
|
+
"or #{valid_values.last.inspect}, is #{value.inspect}"
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def join(*messages)
|
|
20
|
+
messages.map do |message|
|
|
21
|
+
message.end_with?('.') ? message : "#{message}."
|
|
22
|
+
end.join(' ')
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
data/lib/jsapi/version.rb
CHANGED
data/lib/jsapi.rb
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
require 'jsapi/
|
|
4
|
-
require 'jsapi/jsonify_error'
|
|
3
|
+
require 'jsapi/support'
|
|
5
4
|
require 'jsapi/configuration'
|
|
6
5
|
require 'jsapi/media'
|
|
7
6
|
require 'jsapi/status'
|
|
8
7
|
require 'jsapi/model'
|
|
9
|
-
require 'jsapi/
|
|
8
|
+
require 'jsapi/definition'
|
|
10
9
|
require 'jsapi/dsl'
|
|
11
10
|
require 'jsapi/json'
|
|
12
11
|
require 'jsapi/controller'
|
|
12
|
+
require 'jsapi/client'
|
|
13
13
|
require 'jsapi/version'
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: jsapi
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: '3.0'
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Denis Göller
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-10-
|
|
11
|
+
date: 2026-10-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description:
|
|
14
14
|
email: denis@dmgoeller.de
|
|
@@ -17,6 +17,19 @@ extensions: []
|
|
|
17
17
|
extra_rdoc_files: []
|
|
18
18
|
files:
|
|
19
19
|
- lib/jsapi.rb
|
|
20
|
+
- lib/jsapi/client.rb
|
|
21
|
+
- lib/jsapi/client/base.rb
|
|
22
|
+
- lib/jsapi/client/exceptions.rb
|
|
23
|
+
- lib/jsapi/client/request.rb
|
|
24
|
+
- lib/jsapi/client/response.rb
|
|
25
|
+
- lib/jsapi/client/session.rb
|
|
26
|
+
- lib/jsapi/client/session/base.rb
|
|
27
|
+
- lib/jsapi/client/session/logger.rb
|
|
28
|
+
- lib/jsapi/client/session/single_request.rb
|
|
29
|
+
- lib/jsapi/client/session/test.rb
|
|
30
|
+
- lib/jsapi/client/session/test/class_methods.rb
|
|
31
|
+
- lib/jsapi/client/session/test/response.rb
|
|
32
|
+
- lib/jsapi/client/session/test/spy.rb
|
|
20
33
|
- lib/jsapi/configuration.rb
|
|
21
34
|
- lib/jsapi/controller.rb
|
|
22
35
|
- lib/jsapi/controller/actions.rb
|
|
@@ -37,10 +50,107 @@ files:
|
|
|
37
50
|
- lib/jsapi/controller/methods/callbacks/class_methods.rb
|
|
38
51
|
- lib/jsapi/controller/parameters.rb
|
|
39
52
|
- lib/jsapi/controller/response.rb
|
|
53
|
+
- lib/jsapi/definition.rb
|
|
54
|
+
- lib/jsapi/definition/api.rb
|
|
55
|
+
- lib/jsapi/definition/callable.rb
|
|
56
|
+
- lib/jsapi/definition/callable/symbol_evaluator.rb
|
|
57
|
+
- lib/jsapi/definition/callable/symbol_sequence_evaluator.rb
|
|
58
|
+
- lib/jsapi/definition/callback.rb
|
|
59
|
+
- lib/jsapi/definition/callback/base.rb
|
|
60
|
+
- lib/jsapi/definition/callback/reference.rb
|
|
61
|
+
- lib/jsapi/definition/contact.rb
|
|
62
|
+
- lib/jsapi/definition/content.rb
|
|
63
|
+
- lib/jsapi/definition/defaults.rb
|
|
64
|
+
- lib/jsapi/definition/example.rb
|
|
65
|
+
- lib/jsapi/definition/example/base.rb
|
|
66
|
+
- lib/jsapi/definition/example/builder.rb
|
|
67
|
+
- lib/jsapi/definition/example/reference.rb
|
|
68
|
+
- lib/jsapi/definition/existence.rb
|
|
69
|
+
- lib/jsapi/definition/external_documentation.rb
|
|
70
|
+
- lib/jsapi/definition/header.rb
|
|
71
|
+
- lib/jsapi/definition/header/base.rb
|
|
72
|
+
- lib/jsapi/definition/header/reference.rb
|
|
73
|
+
- lib/jsapi/definition/info.rb
|
|
74
|
+
- lib/jsapi/definition/license.rb
|
|
75
|
+
- lib/jsapi/definition/link.rb
|
|
76
|
+
- lib/jsapi/definition/link/base.rb
|
|
77
|
+
- lib/jsapi/definition/link/reference.rb
|
|
78
|
+
- lib/jsapi/definition/model.rb
|
|
79
|
+
- lib/jsapi/definition/model/attributes.rb
|
|
80
|
+
- lib/jsapi/definition/model/attributes/class_methods.rb
|
|
81
|
+
- lib/jsapi/definition/model/attributes/frozen_error.rb
|
|
82
|
+
- lib/jsapi/definition/model/attributes/type_caster.rb
|
|
83
|
+
- lib/jsapi/definition/model/base.rb
|
|
84
|
+
- lib/jsapi/definition/model/reference.rb
|
|
85
|
+
- lib/jsapi/definition/model/wrappable.rb
|
|
86
|
+
- lib/jsapi/definition/model/wrapper.rb
|
|
87
|
+
- lib/jsapi/definition/oauth_flow.rb
|
|
88
|
+
- lib/jsapi/definition/openapi.rb
|
|
89
|
+
- lib/jsapi/definition/openapi/extensions.rb
|
|
90
|
+
- lib/jsapi/definition/openapi/path_item.rb
|
|
91
|
+
- lib/jsapi/definition/openapi/version.rb
|
|
92
|
+
- lib/jsapi/definition/operation.rb
|
|
93
|
+
- lib/jsapi/definition/parameter.rb
|
|
94
|
+
- lib/jsapi/definition/parameter/base.rb
|
|
95
|
+
- lib/jsapi/definition/parameter/reference.rb
|
|
96
|
+
- lib/jsapi/definition/parameter/wrapper.rb
|
|
97
|
+
- lib/jsapi/definition/path.rb
|
|
98
|
+
- lib/jsapi/definition/pathname.rb
|
|
99
|
+
- lib/jsapi/definition/property.rb
|
|
100
|
+
- lib/jsapi/definition/reference_error.rb
|
|
101
|
+
- lib/jsapi/definition/request_body.rb
|
|
102
|
+
- lib/jsapi/definition/request_body/base.rb
|
|
103
|
+
- lib/jsapi/definition/request_body/reference.rb
|
|
104
|
+
- lib/jsapi/definition/request_body/wrapper.rb
|
|
105
|
+
- lib/jsapi/definition/rescue_handler.rb
|
|
106
|
+
- lib/jsapi/definition/response.rb
|
|
107
|
+
- lib/jsapi/definition/response/base.rb
|
|
108
|
+
- lib/jsapi/definition/response/reference.rb
|
|
109
|
+
- lib/jsapi/definition/response/wrapper.rb
|
|
110
|
+
- lib/jsapi/definition/schema.rb
|
|
111
|
+
- lib/jsapi/definition/schema/additional_properties.rb
|
|
112
|
+
- lib/jsapi/definition/schema/array.rb
|
|
113
|
+
- lib/jsapi/definition/schema/base.rb
|
|
114
|
+
- lib/jsapi/definition/schema/boolean.rb
|
|
115
|
+
- lib/jsapi/definition/schema/boundary.rb
|
|
116
|
+
- lib/jsapi/definition/schema/conversion.rb
|
|
117
|
+
- lib/jsapi/definition/schema/discriminator.rb
|
|
118
|
+
- lib/jsapi/definition/schema/integer.rb
|
|
119
|
+
- lib/jsapi/definition/schema/number.rb
|
|
120
|
+
- lib/jsapi/definition/schema/numeric.rb
|
|
121
|
+
- lib/jsapi/definition/schema/object.rb
|
|
122
|
+
- lib/jsapi/definition/schema/reference.rb
|
|
123
|
+
- lib/jsapi/definition/schema/string.rb
|
|
124
|
+
- lib/jsapi/definition/schema/validation.rb
|
|
125
|
+
- lib/jsapi/definition/schema/validation/base.rb
|
|
126
|
+
- lib/jsapi/definition/schema/validation/enum.rb
|
|
127
|
+
- lib/jsapi/definition/schema/validation/max_items.rb
|
|
128
|
+
- lib/jsapi/definition/schema/validation/max_length.rb
|
|
129
|
+
- lib/jsapi/definition/schema/validation/maximum.rb
|
|
130
|
+
- lib/jsapi/definition/schema/validation/min_items.rb
|
|
131
|
+
- lib/jsapi/definition/schema/validation/min_length.rb
|
|
132
|
+
- lib/jsapi/definition/schema/validation/minimum.rb
|
|
133
|
+
- lib/jsapi/definition/schema/validation/multiple_of.rb
|
|
134
|
+
- lib/jsapi/definition/schema/validation/pattern.rb
|
|
135
|
+
- lib/jsapi/definition/schema/wrapper.rb
|
|
136
|
+
- lib/jsapi/definition/security_requirement.rb
|
|
137
|
+
- lib/jsapi/definition/security_scheme.rb
|
|
138
|
+
- lib/jsapi/definition/security_scheme/api_key.rb
|
|
139
|
+
- lib/jsapi/definition/security_scheme/base.rb
|
|
140
|
+
- lib/jsapi/definition/security_scheme/http.rb
|
|
141
|
+
- lib/jsapi/definition/security_scheme/http/basic.rb
|
|
142
|
+
- lib/jsapi/definition/security_scheme/http/bearer.rb
|
|
143
|
+
- lib/jsapi/definition/security_scheme/http/other.rb
|
|
144
|
+
- lib/jsapi/definition/security_scheme/mutual_tls.rb
|
|
145
|
+
- lib/jsapi/definition/security_scheme/oauth2.rb
|
|
146
|
+
- lib/jsapi/definition/security_scheme/open_id_connect.rb
|
|
147
|
+
- lib/jsapi/definition/server.rb
|
|
148
|
+
- lib/jsapi/definition/server_variable.rb
|
|
149
|
+
- lib/jsapi/definition/tag.rb
|
|
40
150
|
- lib/jsapi/dsl.rb
|
|
151
|
+
- lib/jsapi/dsl/api.rb
|
|
41
152
|
- lib/jsapi/dsl/base.rb
|
|
42
153
|
- lib/jsapi/dsl/class_methods.rb
|
|
43
|
-
- lib/jsapi/dsl/definitions.rb
|
|
44
154
|
- lib/jsapi/dsl/examples.rb
|
|
45
155
|
- lib/jsapi/dsl/operation.rb
|
|
46
156
|
- lib/jsapi/dsl/parameter.rb
|
|
@@ -58,109 +168,10 @@ files:
|
|
|
58
168
|
- lib/jsapi/json/object.rb
|
|
59
169
|
- lib/jsapi/json/string.rb
|
|
60
170
|
- lib/jsapi/json/value.rb
|
|
61
|
-
- lib/jsapi/jsonify_error.rb
|
|
62
171
|
- lib/jsapi/media.rb
|
|
63
172
|
- lib/jsapi/media/range.rb
|
|
64
173
|
- lib/jsapi/media/type.rb
|
|
65
174
|
- lib/jsapi/media/type_and_subtype.rb
|
|
66
|
-
- lib/jsapi/messages.rb
|
|
67
|
-
- lib/jsapi/meta.rb
|
|
68
|
-
- lib/jsapi/meta/callable.rb
|
|
69
|
-
- lib/jsapi/meta/callable/symbol_evaluator.rb
|
|
70
|
-
- lib/jsapi/meta/callable/symbol_sequence_evaluator.rb
|
|
71
|
-
- lib/jsapi/meta/callback.rb
|
|
72
|
-
- lib/jsapi/meta/callback/base.rb
|
|
73
|
-
- lib/jsapi/meta/callback/reference.rb
|
|
74
|
-
- lib/jsapi/meta/contact.rb
|
|
75
|
-
- lib/jsapi/meta/content.rb
|
|
76
|
-
- lib/jsapi/meta/defaults.rb
|
|
77
|
-
- lib/jsapi/meta/definitions.rb
|
|
78
|
-
- lib/jsapi/meta/example.rb
|
|
79
|
-
- lib/jsapi/meta/example/base.rb
|
|
80
|
-
- lib/jsapi/meta/example/builder.rb
|
|
81
|
-
- lib/jsapi/meta/example/reference.rb
|
|
82
|
-
- lib/jsapi/meta/existence.rb
|
|
83
|
-
- lib/jsapi/meta/external_documentation.rb
|
|
84
|
-
- lib/jsapi/meta/header.rb
|
|
85
|
-
- lib/jsapi/meta/header/base.rb
|
|
86
|
-
- lib/jsapi/meta/header/reference.rb
|
|
87
|
-
- lib/jsapi/meta/info.rb
|
|
88
|
-
- lib/jsapi/meta/license.rb
|
|
89
|
-
- lib/jsapi/meta/link.rb
|
|
90
|
-
- lib/jsapi/meta/link/base.rb
|
|
91
|
-
- lib/jsapi/meta/link/reference.rb
|
|
92
|
-
- lib/jsapi/meta/model.rb
|
|
93
|
-
- lib/jsapi/meta/model/attributes.rb
|
|
94
|
-
- lib/jsapi/meta/model/attributes/class_methods.rb
|
|
95
|
-
- lib/jsapi/meta/model/attributes/frozen_error.rb
|
|
96
|
-
- lib/jsapi/meta/model/attributes/type_caster.rb
|
|
97
|
-
- lib/jsapi/meta/model/base.rb
|
|
98
|
-
- lib/jsapi/meta/model/reference.rb
|
|
99
|
-
- lib/jsapi/meta/model/wrappable.rb
|
|
100
|
-
- lib/jsapi/meta/model/wrapper.rb
|
|
101
|
-
- lib/jsapi/meta/oauth_flow.rb
|
|
102
|
-
- lib/jsapi/meta/openapi.rb
|
|
103
|
-
- lib/jsapi/meta/openapi/extensions.rb
|
|
104
|
-
- lib/jsapi/meta/openapi/path_item.rb
|
|
105
|
-
- lib/jsapi/meta/openapi/version.rb
|
|
106
|
-
- lib/jsapi/meta/operation.rb
|
|
107
|
-
- lib/jsapi/meta/parameter.rb
|
|
108
|
-
- lib/jsapi/meta/parameter/base.rb
|
|
109
|
-
- lib/jsapi/meta/parameter/reference.rb
|
|
110
|
-
- lib/jsapi/meta/parameter/wrapper.rb
|
|
111
|
-
- lib/jsapi/meta/path.rb
|
|
112
|
-
- lib/jsapi/meta/pathname.rb
|
|
113
|
-
- lib/jsapi/meta/property.rb
|
|
114
|
-
- lib/jsapi/meta/reference_error.rb
|
|
115
|
-
- lib/jsapi/meta/request_body.rb
|
|
116
|
-
- lib/jsapi/meta/request_body/base.rb
|
|
117
|
-
- lib/jsapi/meta/request_body/reference.rb
|
|
118
|
-
- lib/jsapi/meta/request_body/wrapper.rb
|
|
119
|
-
- lib/jsapi/meta/rescue_handler.rb
|
|
120
|
-
- lib/jsapi/meta/response.rb
|
|
121
|
-
- lib/jsapi/meta/response/base.rb
|
|
122
|
-
- lib/jsapi/meta/response/reference.rb
|
|
123
|
-
- lib/jsapi/meta/response/wrapper.rb
|
|
124
|
-
- lib/jsapi/meta/schema.rb
|
|
125
|
-
- lib/jsapi/meta/schema/additional_properties.rb
|
|
126
|
-
- lib/jsapi/meta/schema/array.rb
|
|
127
|
-
- lib/jsapi/meta/schema/base.rb
|
|
128
|
-
- lib/jsapi/meta/schema/boolean.rb
|
|
129
|
-
- lib/jsapi/meta/schema/boundary.rb
|
|
130
|
-
- lib/jsapi/meta/schema/conversion.rb
|
|
131
|
-
- lib/jsapi/meta/schema/discriminator.rb
|
|
132
|
-
- lib/jsapi/meta/schema/integer.rb
|
|
133
|
-
- lib/jsapi/meta/schema/number.rb
|
|
134
|
-
- lib/jsapi/meta/schema/numeric.rb
|
|
135
|
-
- lib/jsapi/meta/schema/object.rb
|
|
136
|
-
- lib/jsapi/meta/schema/reference.rb
|
|
137
|
-
- lib/jsapi/meta/schema/string.rb
|
|
138
|
-
- lib/jsapi/meta/schema/validation.rb
|
|
139
|
-
- lib/jsapi/meta/schema/validation/base.rb
|
|
140
|
-
- lib/jsapi/meta/schema/validation/enum.rb
|
|
141
|
-
- lib/jsapi/meta/schema/validation/max_items.rb
|
|
142
|
-
- lib/jsapi/meta/schema/validation/max_length.rb
|
|
143
|
-
- lib/jsapi/meta/schema/validation/maximum.rb
|
|
144
|
-
- lib/jsapi/meta/schema/validation/min_items.rb
|
|
145
|
-
- lib/jsapi/meta/schema/validation/min_length.rb
|
|
146
|
-
- lib/jsapi/meta/schema/validation/minimum.rb
|
|
147
|
-
- lib/jsapi/meta/schema/validation/multiple_of.rb
|
|
148
|
-
- lib/jsapi/meta/schema/validation/pattern.rb
|
|
149
|
-
- lib/jsapi/meta/schema/wrapper.rb
|
|
150
|
-
- lib/jsapi/meta/security_requirement.rb
|
|
151
|
-
- lib/jsapi/meta/security_scheme.rb
|
|
152
|
-
- lib/jsapi/meta/security_scheme/api_key.rb
|
|
153
|
-
- lib/jsapi/meta/security_scheme/base.rb
|
|
154
|
-
- lib/jsapi/meta/security_scheme/http.rb
|
|
155
|
-
- lib/jsapi/meta/security_scheme/http/basic.rb
|
|
156
|
-
- lib/jsapi/meta/security_scheme/http/bearer.rb
|
|
157
|
-
- lib/jsapi/meta/security_scheme/http/other.rb
|
|
158
|
-
- lib/jsapi/meta/security_scheme/mutual_tls.rb
|
|
159
|
-
- lib/jsapi/meta/security_scheme/oauth2.rb
|
|
160
|
-
- lib/jsapi/meta/security_scheme/open_id_connect.rb
|
|
161
|
-
- lib/jsapi/meta/server.rb
|
|
162
|
-
- lib/jsapi/meta/server_variable.rb
|
|
163
|
-
- lib/jsapi/meta/tag.rb
|
|
164
175
|
- lib/jsapi/model.rb
|
|
165
176
|
- lib/jsapi/model/base.rb
|
|
166
177
|
- lib/jsapi/model/error.rb
|
|
@@ -172,6 +183,8 @@ files:
|
|
|
172
183
|
- lib/jsapi/status/code.rb
|
|
173
184
|
- lib/jsapi/status/default.rb
|
|
174
185
|
- lib/jsapi/status/range.rb
|
|
186
|
+
- lib/jsapi/support.rb
|
|
187
|
+
- lib/jsapi/support/messages.rb
|
|
175
188
|
- lib/jsapi/version.rb
|
|
176
189
|
homepage: https://github.com/dmgoeller/jsapi
|
|
177
190
|
licenses:
|
data/lib/jsapi/jsonify_error.rb
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Jsapi
|
|
4
|
-
# Raised when jsonifying an object fails.
|
|
5
|
-
class JsonifyError < RuntimeError
|
|
6
|
-
attr_reader :path # :nodoc:
|
|
7
|
-
|
|
8
|
-
def message
|
|
9
|
-
[@path&.delete_prefix('.'), super].compact.join(' ')
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
def prepend(origin) # :nodoc:
|
|
13
|
-
@path = "#{origin}#{@path}"
|
|
14
|
-
self
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
data/lib/jsapi/messages.rb
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module Jsapi
|
|
4
|
-
module Messages # :nodoc:
|
|
5
|
-
class << self
|
|
6
|
-
def invalid_value(name:, value:, valid_values: [])
|
|
7
|
-
case valid_values.count
|
|
8
|
-
when 0
|
|
9
|
-
"#{name} must not be #{value.inspect}"
|
|
10
|
-
when 1
|
|
11
|
-
"#{name} must be #{valid_values.first.inspect}, is #{value.inspect}"
|
|
12
|
-
else
|
|
13
|
-
"#{name} must be one of #{valid_values[0..-2].map(&:inspect).join(', ')} " \
|
|
14
|
-
"or #{valid_values.last.inspect}, is #{value.inspect}"
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
19
|
-
end
|
data/lib/jsapi/meta.rb
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require_relative 'meta/reference_error'
|
|
4
|
-
require_relative 'meta/callable'
|
|
5
|
-
require_relative 'meta/existence'
|
|
6
|
-
require_relative 'meta/openapi'
|
|
7
|
-
require_relative 'meta/model'
|
|
8
|
-
require_relative 'meta/defaults'
|
|
9
|
-
require_relative 'meta/example'
|
|
10
|
-
require_relative 'meta/external_documentation'
|
|
11
|
-
require_relative 'meta/tag'
|
|
12
|
-
require_relative 'meta/server_variable'
|
|
13
|
-
require_relative 'meta/server'
|
|
14
|
-
require_relative 'meta/callback'
|
|
15
|
-
require_relative 'meta/contact'
|
|
16
|
-
require_relative 'meta/license'
|
|
17
|
-
require_relative 'meta/info'
|
|
18
|
-
require_relative 'meta/header'
|
|
19
|
-
require_relative 'meta/oauth_flow'
|
|
20
|
-
require_relative 'meta/security_scheme'
|
|
21
|
-
require_relative 'meta/security_requirement'
|
|
22
|
-
require_relative 'meta/link'
|
|
23
|
-
require_relative 'meta/property'
|
|
24
|
-
require_relative 'meta/schema'
|
|
25
|
-
require_relative 'meta/content'
|
|
26
|
-
require_relative 'meta/request_body'
|
|
27
|
-
require_relative 'meta/parameter'
|
|
28
|
-
require_relative 'meta/pathname'
|
|
29
|
-
require_relative 'meta/response'
|
|
30
|
-
require_relative 'meta/operation'
|
|
31
|
-
require_relative 'meta/path'
|
|
32
|
-
require_relative 'meta/rescue_handler'
|
|
33
|
-
require_relative 'meta/definitions'
|
|
34
|
-
|
|
35
|
-
module Jsapi
|
|
36
|
-
# The meta model.
|
|
37
|
-
module Meta end
|
|
38
|
-
end
|
|
File without changes
|
|
File without changes
|