jsapi 1.1.1 → 1.3
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/configuration.rb +2 -2
- data/lib/jsapi/controller/methods.rb +17 -4
- data/lib/jsapi/controller/parameters.rb +27 -10
- data/lib/jsapi/controller/response.rb +29 -5
- data/lib/jsapi/json/array.rb +4 -0
- data/lib/jsapi/json/object.rb +2 -0
- data/lib/jsapi/json/value.rb +5 -0
- data/lib/jsapi/meta/callback/base.rb +1 -1
- data/lib/jsapi/meta/definitions.rb +10 -6
- data/lib/jsapi/meta/example/base.rb +4 -6
- data/lib/jsapi/meta/link/base.rb +4 -2
- data/lib/jsapi/meta/oauth_flow.rb +11 -2
- data/lib/jsapi/meta/openapi/path_item.rb +46 -0
- data/lib/jsapi/meta/openapi/version.rb +6 -0
- data/lib/jsapi/meta/openapi.rb +2 -0
- data/lib/jsapi/meta/operation.rb +6 -14
- data/lib/jsapi/meta/parameter/base.rb +82 -59
- data/lib/jsapi/meta/request_body/base.rb +3 -2
- data/lib/jsapi/meta/response/base.rb +26 -8
- data/lib/jsapi/meta/schema/base.rb +1 -1
- data/lib/jsapi/meta/schema/discriminator.rb +14 -4
- data/lib/jsapi/meta/schema/object.rb +28 -9
- data/lib/jsapi/meta/schema/validation/maximum.rb +1 -1
- data/lib/jsapi/meta/schema/validation/minimum.rb +1 -1
- data/lib/jsapi/meta/security_scheme/api_key.rb +4 -5
- data/lib/jsapi/meta/security_scheme/base.rb +16 -0
- data/lib/jsapi/meta/security_scheme/http/basic.rb +3 -10
- data/lib/jsapi/meta/security_scheme/http/bearer.rb +8 -8
- data/lib/jsapi/meta/security_scheme/http/other.rb +3 -5
- data/lib/jsapi/meta/security_scheme/mutual_tls.rb +23 -0
- data/lib/jsapi/meta/security_scheme/oauth2.rb +29 -13
- data/lib/jsapi/meta/security_scheme/open_id_connect.rb +5 -8
- data/lib/jsapi/meta/security_scheme.rb +3 -0
- data/lib/jsapi/meta/server.rb +9 -1
- data/lib/jsapi/meta/tag.rb +34 -4
- data/lib/jsapi/model/base.rb +37 -1
- data/lib/jsapi/model/nestable.rb +27 -1
- data/lib/jsapi/version.rb +1 -1
- metadata +4 -2
|
@@ -4,9 +4,6 @@ module Jsapi
|
|
|
4
4
|
module Meta
|
|
5
5
|
module SecurityScheme
|
|
6
6
|
# Specifies a security scheme based on OpenID Connect.
|
|
7
|
-
#
|
|
8
|
-
# OpenID Connect was introduced with \OpenAPI 3.0. Thus, a security scheme of
|
|
9
|
-
# this class is skipped when generating an \OpenAPI 2.0 document.
|
|
10
7
|
class OpenIDConnect < Base
|
|
11
8
|
include OpenAPI::Extensions
|
|
12
9
|
|
|
@@ -15,15 +12,15 @@ module Jsapi
|
|
|
15
12
|
attribute :open_id_connect_url, String
|
|
16
13
|
|
|
17
14
|
# Returns a hash representing the \OpenAPI security scheme object, or +nil+
|
|
18
|
-
# if <code>version
|
|
15
|
+
# if <code>version</code> is less than \OpenAPI 3.0.
|
|
19
16
|
def to_openapi(version, *)
|
|
20
17
|
version = OpenAPI::Version.from(version)
|
|
21
|
-
return if version
|
|
18
|
+
return if version < OpenAPI::V3_0
|
|
22
19
|
|
|
23
20
|
with_openapi_extensions(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
base_openapi_fields('openIdConnect', version).merge(
|
|
22
|
+
openIdConnectUrl: open_id_connect_url
|
|
23
|
+
)
|
|
27
24
|
)
|
|
28
25
|
end
|
|
29
26
|
end
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
require_relative 'security_scheme/base'
|
|
4
4
|
require_relative 'security_scheme/api_key'
|
|
5
5
|
require_relative 'security_scheme/http'
|
|
6
|
+
require_relative 'security_scheme/mutual_tls'
|
|
6
7
|
require_relative 'security_scheme/oauth2'
|
|
7
8
|
require_relative 'security_scheme/open_id_connect'
|
|
8
9
|
|
|
@@ -31,6 +32,8 @@ module Jsapi
|
|
|
31
32
|
HTTP.new(keywords.merge(scheme: 'basic'))
|
|
32
33
|
when 'http' # OpenAPI 3.0 and higher
|
|
33
34
|
HTTP.new(keywords)
|
|
35
|
+
when 'mutual_tls' # OpenAPI 3.1 and higher
|
|
36
|
+
MutualTLS.new(keywords)
|
|
34
37
|
when 'oauth2'
|
|
35
38
|
OAuth2.new(keywords)
|
|
36
39
|
when 'open_id_connect' # OpenAPI 3.0 and higher
|
data/lib/jsapi/meta/server.rb
CHANGED
|
@@ -11,6 +11,11 @@ module Jsapi
|
|
|
11
11
|
# The description of the server.
|
|
12
12
|
attribute :description, String
|
|
13
13
|
|
|
14
|
+
##
|
|
15
|
+
# :attr: name
|
|
16
|
+
# The optional unique name of the server. Applies to \OpenAPI 3.2 and higher.
|
|
17
|
+
attribute :name, String
|
|
18
|
+
|
|
14
19
|
##
|
|
15
20
|
# :attr: url
|
|
16
21
|
# The absolute or relative URL of the server.
|
|
@@ -22,10 +27,13 @@ module Jsapi
|
|
|
22
27
|
attribute :variables, { String => ServerVariable }
|
|
23
28
|
|
|
24
29
|
# Returns a hash representing the \OpenAPI server object.
|
|
25
|
-
def to_openapi(*)
|
|
30
|
+
def to_openapi(version, *)
|
|
31
|
+
version = OpenAPI::Version.from(version)
|
|
32
|
+
|
|
26
33
|
with_openapi_extensions(
|
|
27
34
|
url: url,
|
|
28
35
|
description: description,
|
|
36
|
+
name: (name if version >= OpenAPI::V3_2),
|
|
29
37
|
variables: variables.transform_values(&:to_openapi).presence
|
|
30
38
|
)
|
|
31
39
|
end
|
data/lib/jsapi/meta/tag.rb
CHANGED
|
@@ -16,17 +16,47 @@ module Jsapi
|
|
|
16
16
|
# The ExternalDocumentation object.
|
|
17
17
|
attribute :external_docs, ExternalDocumentation
|
|
18
18
|
|
|
19
|
+
##
|
|
20
|
+
# :attr: kind
|
|
21
|
+
# The category of the tag. Applies to \OpenAPI 3.2 and higher.
|
|
22
|
+
attribute :kind, String
|
|
23
|
+
|
|
19
24
|
##
|
|
20
25
|
# :attr: name
|
|
21
26
|
# The name of the tag.
|
|
22
27
|
attribute :name, String
|
|
23
28
|
|
|
29
|
+
##
|
|
30
|
+
# :attr: parent
|
|
31
|
+
# The name of the parent tag. Applies to \OpenAPI 3.2 and higher.
|
|
32
|
+
attribute :parent, String
|
|
33
|
+
|
|
34
|
+
##
|
|
35
|
+
# :attr: summary
|
|
36
|
+
# The short summary of the tag. Applies to \OpenAPI 3.2 and higher.
|
|
37
|
+
attribute :summary, String
|
|
38
|
+
|
|
24
39
|
# Returns a hash representing the \OpenAPI tag object.
|
|
25
|
-
def to_openapi(*)
|
|
40
|
+
def to_openapi(version, *)
|
|
41
|
+
version = OpenAPI::Version.from(version)
|
|
42
|
+
|
|
26
43
|
with_openapi_extensions(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
44
|
+
if version >= OpenAPI::V3_2
|
|
45
|
+
{
|
|
46
|
+
name: name,
|
|
47
|
+
summary: summary,
|
|
48
|
+
description: description,
|
|
49
|
+
externalDocs: external_docs&.to_openapi,
|
|
50
|
+
parent: parent,
|
|
51
|
+
kind: kind
|
|
52
|
+
}
|
|
53
|
+
else
|
|
54
|
+
{
|
|
55
|
+
name: name,
|
|
56
|
+
description: description,
|
|
57
|
+
externalDocs: external_docs&.to_openapi
|
|
58
|
+
}
|
|
59
|
+
end
|
|
30
60
|
)
|
|
31
61
|
end
|
|
32
62
|
end
|
data/lib/jsapi/model/base.rb
CHANGED
|
@@ -25,7 +25,43 @@ module Jsapi
|
|
|
25
25
|
extend ActiveModel::Translation
|
|
26
26
|
include ActiveModel::Validations
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
##
|
|
29
|
+
# :method: []
|
|
30
|
+
# :call-seq: [](name)
|
|
31
|
+
#
|
|
32
|
+
# Returns the value assigned to +name+.
|
|
33
|
+
|
|
34
|
+
##
|
|
35
|
+
# :method: additional_attributes
|
|
36
|
+
#
|
|
37
|
+
# Returns a hash containing the additional attributes.
|
|
38
|
+
|
|
39
|
+
##
|
|
40
|
+
# :method: attribute?
|
|
41
|
+
# :call-seq: attribute?(name)
|
|
42
|
+
#
|
|
43
|
+
# Returns +true+ if +name+ is present, +false+ otherwise.
|
|
44
|
+
|
|
45
|
+
##
|
|
46
|
+
# :method: attributes
|
|
47
|
+
#
|
|
48
|
+
# Returns a hash containing all attributes.
|
|
49
|
+
|
|
50
|
+
##
|
|
51
|
+
# :method: serializable_hash
|
|
52
|
+
# :call-seq: serializable_hash(**options)
|
|
53
|
+
#
|
|
54
|
+
# Returns a hash containing serializable representations of all attributes.
|
|
55
|
+
#
|
|
56
|
+
# Possible options are:
|
|
57
|
+
#
|
|
58
|
+
# - +:only+ - The hash contains the given attributes only.
|
|
59
|
+
# - +:except+ - The hash does not contain the given attributes.
|
|
60
|
+
# - +:symbolize_names+ - If set to true, keys are symbols.
|
|
61
|
+
# - +:jsonify_values+ - If set to true, values are converted by +as_json+.
|
|
62
|
+
|
|
63
|
+
delegate :[], :additional_attributes, :attribute?, :attributes,
|
|
64
|
+
:serializable_hash, to: :@nested
|
|
29
65
|
|
|
30
66
|
validate :_nested_validity
|
|
31
67
|
|
data/lib/jsapi/model/nestable.rb
CHANGED
|
@@ -13,7 +13,7 @@ module Jsapi
|
|
|
13
13
|
raw_additional_attributes.transform_values(&:value)
|
|
14
14
|
end
|
|
15
15
|
|
|
16
|
-
# Returns +true+ if +name+ is present, false
|
|
16
|
+
# Returns +true+ if +name+ is present, +false+ otherwise.
|
|
17
17
|
def attribute?(name)
|
|
18
18
|
raw_attributes.key?(name&.to_s)
|
|
19
19
|
end
|
|
@@ -32,6 +32,32 @@ module Jsapi
|
|
|
32
32
|
}>"
|
|
33
33
|
end
|
|
34
34
|
|
|
35
|
+
# Returns a hash containing serializable representations of all attributes.
|
|
36
|
+
#
|
|
37
|
+
# Possible options are:
|
|
38
|
+
#
|
|
39
|
+
# - +:only+ - The hash contains the given attributes only.
|
|
40
|
+
# - +:except+ - The hash does not contain the given attributes.
|
|
41
|
+
# - +:symbolize_names+ - If set to true, keys are symbols.
|
|
42
|
+
# - +:jsonify_values+ - If set to true, values are converted by +as_json+.
|
|
43
|
+
def serializable_hash(**options)
|
|
44
|
+
options = options.dup
|
|
45
|
+
except = options.delete(:except)&.map(&:to_s)
|
|
46
|
+
only = options.delete(:only)&.map(&:to_s)
|
|
47
|
+
symbolize_names = options[:symbolize_names] == true
|
|
48
|
+
|
|
49
|
+
{}.tap do |hash|
|
|
50
|
+
[raw_attributes, raw_additional_attributes].each do |attributes|
|
|
51
|
+
attributes.each do |name, value|
|
|
52
|
+
next if except&.include?(name) || only&.exclude?(name)
|
|
53
|
+
|
|
54
|
+
name = name.to_sym if symbolize_names
|
|
55
|
+
hash[name] = value.serializable_value(**options)
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
35
61
|
private
|
|
36
62
|
|
|
37
63
|
def validate_attributes(errors)
|
data/lib/jsapi/version.rb
CHANGED
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: 1.
|
|
4
|
+
version: '1.3'
|
|
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: 2025-
|
|
11
|
+
date: 2025-11-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description:
|
|
14
14
|
email: denis@dmgoeller.de
|
|
@@ -80,6 +80,7 @@ files:
|
|
|
80
80
|
- lib/jsapi/meta/oauth_flow.rb
|
|
81
81
|
- lib/jsapi/meta/openapi.rb
|
|
82
82
|
- lib/jsapi/meta/openapi/extensions.rb
|
|
83
|
+
- lib/jsapi/meta/openapi/path_item.rb
|
|
83
84
|
- lib/jsapi/meta/openapi/version.rb
|
|
84
85
|
- lib/jsapi/meta/operation.rb
|
|
85
86
|
- lib/jsapi/meta/parameter.rb
|
|
@@ -128,6 +129,7 @@ files:
|
|
|
128
129
|
- lib/jsapi/meta/security_scheme/http/basic.rb
|
|
129
130
|
- lib/jsapi/meta/security_scheme/http/bearer.rb
|
|
130
131
|
- lib/jsapi/meta/security_scheme/http/other.rb
|
|
132
|
+
- lib/jsapi/meta/security_scheme/mutual_tls.rb
|
|
131
133
|
- lib/jsapi/meta/security_scheme/oauth2.rb
|
|
132
134
|
- lib/jsapi/meta/security_scheme/open_id_connect.rb
|
|
133
135
|
- lib/jsapi/meta/server.rb
|