swagger-dsl 1.4.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +0 -0
- data/.gitignore +0 -0
- data/.prettierrc +0 -0
- data/.rspec +0 -0
- data/.rubocop.yml +0 -0
- data/.rubocop_airbnb.yml +0 -0
- data/CHANGELOG.md +4 -0
- data/Gemfile +0 -0
- data/LICENSE +0 -0
- data/README.md +0 -0
- data/Rakefile +0 -0
- data/lib/swagger/dsl/components.rb +0 -0
- data/lib/swagger/dsl/config.rb +0 -0
- data/lib/swagger/dsl/json_schema/jimmy.rb +0 -0
- data/lib/swagger/dsl/json_schema/jimmy_patch.rb +1 -1
- data/lib/swagger/dsl/json_schema/subset_dsl.rb +0 -0
- data/lib/swagger/dsl/json_schema.rb +0 -0
- data/lib/swagger/dsl/operation.rb +18 -2
- data/lib/swagger/dsl/parameter.rb +0 -0
- data/lib/swagger/dsl/parameters.rb +0 -0
- data/lib/swagger/dsl/parameters_in_type.rb +0 -0
- data/lib/swagger/dsl/rails_controller.rb +0 -0
- data/lib/swagger/dsl/resolve_module.rb +0 -0
- data/lib/swagger/dsl/serializer.rb +1 -1
- data/lib/swagger/dsl/version.rb +1 -1
- data/lib/swagger/dsl.rb +3 -2
- data/swagger-dsl.gemspec +5 -3
- metadata +44 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e4b01a3c2f9182385dc31cf96d36b19781fb69c58403642c410e36e8e5cf3e0
|
4
|
+
data.tar.gz: ba787a1d0b03f8f214aca38482ad1e8dc7d9e7b9c8e7eea1c4d2e0432c9b4a4f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 103ae693a31e19ea4c0c786f5b2add798da809a473f9113e7b297d39275a139f7089b1c300bfe2c40895a713c2e6011a6188cb4e722d44ae983cb2ded6082996
|
7
|
+
data.tar.gz: e8771d5f49a83fed9673a25e147d232920fc315affe95728a7293b7bdbf1d6a61ea6aa33c99c32dffa4c98dd1a43b46297008afc3b7b543fc254690cae58d9c9
|
data/.github/workflows/ruby.yml
CHANGED
File without changes
|
data/.gitignore
CHANGED
File without changes
|
data/.prettierrc
CHANGED
File without changes
|
data/.rspec
CHANGED
File without changes
|
data/.rubocop.yml
CHANGED
File without changes
|
data/.rubocop_airbnb.yml
CHANGED
File without changes
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
File without changes
|
data/LICENSE
CHANGED
File without changes
|
data/README.md
CHANGED
File without changes
|
data/Rakefile
CHANGED
File without changes
|
File without changes
|
data/lib/swagger/dsl/config.rb
CHANGED
File without changes
|
File without changes
|
@@ -5,7 +5,7 @@ module Jimmy
|
|
5
5
|
class SchemaCreation
|
6
6
|
module Referencing
|
7
7
|
def component(id)
|
8
|
-
name = "#/components/#{id}"
|
8
|
+
name = "#/components/schemas/#{id}"
|
9
9
|
reference_name = Swagger::DSL.current.config.dsl_options[:reference_name]
|
10
10
|
reference_name ? reference_name.call(name) : name
|
11
11
|
end
|
File without changes
|
File without changes
|
@@ -16,33 +16,49 @@ module Swagger
|
|
16
16
|
|
17
17
|
def initialize(operation_id, format: :json, &block)
|
18
18
|
self["operationId"] = operation_id
|
19
|
-
self["requestBody"] = { "content" => {}, "required" => true }
|
20
19
|
self["responses"] = {}
|
21
20
|
self["parameters"] = []
|
21
|
+
self["tags"] = []
|
22
22
|
@format = format
|
23
23
|
instance_eval(&block)
|
24
24
|
end
|
25
25
|
|
26
|
+
def summary(text)
|
27
|
+
self["summary"] = text
|
28
|
+
end
|
29
|
+
|
30
|
+
def description(text)
|
31
|
+
self["description"] = text
|
32
|
+
end
|
33
|
+
|
34
|
+
def tags(*tags)
|
35
|
+
self["tags"].concat(tags.flatten(1))
|
36
|
+
end
|
37
|
+
|
26
38
|
def params(default_required: Swagger::DSL.current.config.default_required, &block)
|
27
39
|
self["parameters"] = Parameters.new(default_required: default_required, &block)
|
28
40
|
end
|
29
41
|
|
30
42
|
def body(format: @format, dsl: nil, &block)
|
31
43
|
formats(format).each do |f|
|
44
|
+
self["requestBody"] ||= { "required" => true }
|
45
|
+
self["requestBody"]["content"] ||= {}
|
32
46
|
self["requestBody"]["content"][f] = { "schema" => Swagger::DSL::JsonSchema.by(dsl).dsl(&block) }
|
33
47
|
end
|
34
48
|
end
|
35
49
|
|
36
50
|
def body_description(body_description = nil)
|
51
|
+
self["requestBody"] ||= { "required" => true }
|
37
52
|
self["requestBody"]["description"] = body_description
|
38
53
|
end
|
39
54
|
|
40
55
|
def body_optional(optional = true)
|
56
|
+
self["requestBody"] ||= {}
|
41
57
|
self["requestBody"]["required"] = optional
|
42
58
|
end
|
43
59
|
|
44
60
|
def render(code = 200, format: @format, dsl: nil, &block)
|
45
|
-
self["responses"][code] ||= { "content" => {} }
|
61
|
+
self["responses"][code] ||= { "content" => {}, "description" => "#{code}" }
|
46
62
|
formats(format).each do |f|
|
47
63
|
self["responses"][code]["content"][f] = { "schema" => Swagger::DSL::JsonSchema.by(dsl).dsl(&block) }
|
48
64
|
end
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -6,7 +6,7 @@ module Swagger
|
|
6
6
|
module Serializer
|
7
7
|
def swagger(dsl: nil, &block)
|
8
8
|
name = self.name.sub(/Serializer$/, "")
|
9
|
-
Swagger::DSL.current["components"][name] =
|
9
|
+
Swagger::DSL.current["components"]["schemas"][name] =
|
10
10
|
Swagger::DSL::JsonSchema.by(dsl).dsl(&block).merge(Swagger::DSL.current.config.inject_key => name)
|
11
11
|
end
|
12
12
|
|
data/lib/swagger/dsl/version.rb
CHANGED
data/lib/swagger/dsl.rb
CHANGED
@@ -20,9 +20,10 @@ module Swagger
|
|
20
20
|
def initialize(schema = nil, config: Config.new)
|
21
21
|
merge!(schema || {})
|
22
22
|
self["openapi"] ||= "3.0.0"
|
23
|
-
self["info"] ||= {}
|
23
|
+
self["info"] ||= { "title" => "OpenAPI schema", "version" => "0.0.0" }
|
24
24
|
self["paths"] ||= {}
|
25
|
-
self["components"]
|
25
|
+
self["components"] ||= {}
|
26
|
+
self["components"]["schemas"] = Components[self["components"]["schemas"] || {}]
|
26
27
|
@config = config
|
27
28
|
@define_paths_procs = []
|
28
29
|
end
|
data/swagger-dsl.gemspec
CHANGED
@@ -28,12 +28,12 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.require_paths = %w[lib]
|
29
29
|
|
30
30
|
spec.add_dependency "jimmy", "~> 0.5"
|
31
|
-
spec.add_dependency "json-schema-subset-dsl", "~>
|
31
|
+
spec.add_dependency "json-schema-subset-dsl", "~> 2.0"
|
32
32
|
spec.add_dependency "hana", "~> 1.3"
|
33
33
|
spec.add_dependency "json_refs", "~> 0.1"
|
34
|
-
spec.add_dependency "activesupport", "
|
34
|
+
spec.add_dependency "activesupport", ">= 4.0.2"
|
35
35
|
spec.add_development_dependency "bundler", "~> 2.0"
|
36
|
-
spec.add_development_dependency "rake", "~>
|
36
|
+
spec.add_development_dependency "rake", "~> 13.0"
|
37
37
|
spec.add_development_dependency "rspec", "~> 3.9"
|
38
38
|
spec.add_development_dependency "rspec-power_assert", "~> 1.1"
|
39
39
|
spec.add_development_dependency "rubocop", "~> 0.76"
|
@@ -42,4 +42,6 @@ Gem::Specification.new do |spec|
|
|
42
42
|
spec.add_development_dependency "rubocop-config-prettier", "~> 0.1"
|
43
43
|
spec.add_development_dependency "yard", "~> 0.9"
|
44
44
|
spec.add_development_dependency "pry-byebug", "~> 3.7"
|
45
|
+
spec.add_development_dependency "json_spec", "~> 1"
|
46
|
+
spec.add_development_dependency "openapi3_parser", "~> 0.9.1"
|
45
47
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: swagger-dsl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Narazaka
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-03-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jimmy
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '2.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '2.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: hana
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -70,16 +70,16 @@ dependencies:
|
|
70
70
|
name: activesupport
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 4.0.2
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 4.0.2
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: bundler
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
103
|
+
version: '13.0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
110
|
+
version: '13.0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: rspec
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -220,7 +220,35 @@ dependencies:
|
|
220
220
|
- - "~>"
|
221
221
|
- !ruby/object:Gem::Version
|
222
222
|
version: '3.7'
|
223
|
-
|
223
|
+
- !ruby/object:Gem::Dependency
|
224
|
+
name: json_spec
|
225
|
+
requirement: !ruby/object:Gem::Requirement
|
226
|
+
requirements:
|
227
|
+
- - "~>"
|
228
|
+
- !ruby/object:Gem::Version
|
229
|
+
version: '1'
|
230
|
+
type: :development
|
231
|
+
prerelease: false
|
232
|
+
version_requirements: !ruby/object:Gem::Requirement
|
233
|
+
requirements:
|
234
|
+
- - "~>"
|
235
|
+
- !ruby/object:Gem::Version
|
236
|
+
version: '1'
|
237
|
+
- !ruby/object:Gem::Dependency
|
238
|
+
name: openapi3_parser
|
239
|
+
requirement: !ruby/object:Gem::Requirement
|
240
|
+
requirements:
|
241
|
+
- - "~>"
|
242
|
+
- !ruby/object:Gem::Version
|
243
|
+
version: 0.9.1
|
244
|
+
type: :development
|
245
|
+
prerelease: false
|
246
|
+
version_requirements: !ruby/object:Gem::Requirement
|
247
|
+
requirements:
|
248
|
+
- - "~>"
|
249
|
+
- !ruby/object:Gem::Version
|
250
|
+
version: 0.9.1
|
251
|
+
description:
|
224
252
|
email:
|
225
253
|
- info@narazaka.net
|
226
254
|
executables: []
|
@@ -264,8 +292,8 @@ metadata:
|
|
264
292
|
homepage_uri: https://github.com/Narazaka/swagger-dsl
|
265
293
|
source_code_uri: https://github.com/Narazaka/swagger-dsl.git
|
266
294
|
changelog_uri: https://github.com/Narazaka/swagger-dsl/blob/master/CHANGELOG.md
|
267
|
-
documentation_uri: https://www.rubydoc.info/gems/swagger-dsl/
|
268
|
-
post_install_message:
|
295
|
+
documentation_uri: https://www.rubydoc.info/gems/swagger-dsl/2.0.0
|
296
|
+
post_install_message:
|
269
297
|
rdoc_options: []
|
270
298
|
require_paths:
|
271
299
|
- lib
|
@@ -280,9 +308,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
280
308
|
- !ruby/object:Gem::Version
|
281
309
|
version: '0'
|
282
310
|
requirements: []
|
283
|
-
|
284
|
-
|
285
|
-
signing_key:
|
311
|
+
rubygems_version: 3.1.4
|
312
|
+
signing_key:
|
286
313
|
specification_version: 4
|
287
314
|
summary: Swagger (OpenAPI 3) DSL
|
288
315
|
test_files: []
|