dry-swagger 0.7.2 → 1.0.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/Gemfile.lock +1 -1
- data/README.md +3 -3
- data/lib/dry/swagger/struct_parser.rb +8 -2
- data/lib/dry/swagger/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f02e4e684a8418f7df9ef80cfbbfdbe7169e1e5db8f4bedde227cda11dddf64
|
4
|
+
data.tar.gz: 860a49c5384ca32c9895df6dac3cbec40e2033f6a910c6ae1a00887bf7eeea56
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ab94e41fa7b4e410c1aae8c1b2276ae87455ce85d7ee9b56ee507073cddecd6d32d23e4467d306a717b275e8e19cd794f09adf7dba2e38cd35d8fe74f66fcc1
|
7
|
+
data.tar.gz: 1e70ba36734ba3b2e072b9b840829b30736abe07bdaa8eb57251172681bd53960f1399d6a0f044e514c5d87df3c81c1847b56e27cb6767d22547ff2401ad1e3d
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -21,9 +21,9 @@ After installing, execute the following command:
|
|
21
21
|
|
22
22
|
This will generate configuration files in your project under `project/config`. See Configuration section for more details.
|
23
23
|
|
24
|
-
##Usage
|
24
|
+
## Usage
|
25
25
|
|
26
|
-
####With Dry::Validation::Contract
|
26
|
+
#### With Dry::Validation::Contract
|
27
27
|
Lets say we have the following Dry::Validation::Contract definition:
|
28
28
|
|
29
29
|
class TestContract < Dry::Validation::Contract
|
@@ -149,7 +149,7 @@ Calling `parser.to_swagger` will give the following result:
|
|
149
149
|
]
|
150
150
|
}
|
151
151
|
|
152
|
-
####With Dry::Struct
|
152
|
+
#### With Dry::Struct
|
153
153
|
The `Dry::Swagger::StructParser` works the same as the contract parser.
|
154
154
|
|
155
155
|
The required key depends on whether we define the field as attribute or attribute?
|
@@ -4,7 +4,8 @@ module Dry
|
|
4
4
|
PREDICATE_TYPES = {
|
5
5
|
String: 'string',
|
6
6
|
Integer: 'integer',
|
7
|
-
|
7
|
+
TrueClass: 'boolean',
|
8
|
+
FalseClass: 'boolean',
|
8
9
|
Float: 'float',
|
9
10
|
Date: 'date',
|
10
11
|
DateTime: 'datetime',
|
@@ -89,6 +90,11 @@ module Dry
|
|
89
90
|
type = type.to_s.to_sym
|
90
91
|
return unless PREDICATE_TYPES[type]
|
91
92
|
|
93
|
+
# print node
|
94
|
+
# puts
|
95
|
+
# print opts
|
96
|
+
# puts
|
97
|
+
|
92
98
|
type_definition = {
|
93
99
|
type: PREDICATE_TYPES[type],
|
94
100
|
required: opts.fetch(:required),
|
@@ -117,7 +123,7 @@ module Dry
|
|
117
123
|
|
118
124
|
def visit_sum(node, opts = {})
|
119
125
|
if node[0][0].equal?(:constrained)
|
120
|
-
opts[:nullable] = true
|
126
|
+
opts[:nullable] = true if node[0][1][0][1][0].equal?(NilClass)
|
121
127
|
visit(node[1], opts) # ignore NilClass constrained
|
122
128
|
elsif node[0][0].equal?(:struct) || node[0][0].equal?(:sum)
|
123
129
|
opts[:oneOf] = true
|
data/lib/dry/swagger/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dry-swagger
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jane-Terziev
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-04-29 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: A parser which converts dry-validation or dry-struct into valid swagger
|
14
14
|
documentation
|
@@ -67,7 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
requirements: []
|
70
|
-
rubygems_version: 3.1.
|
70
|
+
rubygems_version: 3.1.6
|
71
71
|
signing_key:
|
72
72
|
specification_version: 4
|
73
73
|
summary: Generate dry-validation and dry-struct into valid swagger documentation
|