dry-swagger 0.7.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b6fef3fca461d0c5cfd951ae54bf8dff0051728aa97a4ab5918372f7821c4b38
4
- data.tar.gz: 0e04e6c2f9701b801d1d53aa99d97b605cff32e4c491bdacc81fcf2a9f4ecfd7
3
+ metadata.gz: 0f02e4e684a8418f7df9ef80cfbbfdbe7169e1e5db8f4bedde227cda11dddf64
4
+ data.tar.gz: 860a49c5384ca32c9895df6dac3cbec40e2033f6a910c6ae1a00887bf7eeea56
5
5
  SHA512:
6
- metadata.gz: eecb6dd9fff1e8c5fee20ea8a7d81f4090ea6617eb887eeb16b84757a9d41d9bfaee3c6584a149c34f30bf76e954337cac508a4fc698e1aaf1cfd8435edc1c6e
7
- data.tar.gz: 826aa9737d2ae9ba26419662589d6f368d50f70198cadc34c0f8f037d3837298c541b07f3c9f4690d8c1d2fa9005d526b2d9d01b8f1120b8bff32666e3c0b24a
6
+ metadata.gz: 9ab94e41fa7b4e410c1aae8c1b2276ae87455ce85d7ee9b56ee507073cddecd6d32d23e4467d306a717b275e8e19cd794f09adf7dba2e38cd35d8fe74f66fcc1
7
+ data.tar.gz: 1e70ba36734ba3b2e072b9b840829b30736abe07bdaa8eb57251172681bd53960f1399d6a0f044e514c5d87df3c81c1847b56e27cb6767d22547ff2401ad1e3d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dry-swagger (0.7.0)
4
+ dry-swagger (1.0.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
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?
@@ -7,8 +7,7 @@ module Dry
7
7
  railtie_name :"dry-swagger"
8
8
 
9
9
  rake_tasks do
10
- path = File.expand_path(__dir__)
11
- Dir.glob("#{path}/tasks/**/*.rake").each { |f| load f }
10
+ load "dry/swagger/tasks/configuration_generator.rake"
12
11
  end
13
12
  end
14
13
  end
@@ -4,7 +4,8 @@ module Dry
4
4
  PREDICATE_TYPES = {
5
5
  String: 'string',
6
6
  Integer: 'integer',
7
- Bool: 'boolean',
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
@@ -1,5 +1,5 @@
1
1
  module Dry
2
2
  module Swagger
3
- VERSION = "0.7.0"
3
+ VERSION = "1.0.0"
4
4
  end
5
5
  end
data/lib/dry/swagger.rb CHANGED
@@ -12,6 +12,6 @@ require 'dry/swagger/railtie' if defined?(Rails)
12
12
 
13
13
  module Dry
14
14
  module Swagger
15
- ::I18n.load_path << Dir[File.expand_path("config/locales") + "/*.yml"]
15
+ ::I18n.load_path << Dir[File.expand_path("config/locales") + "/*.yml"] unless defined?(Rails)
16
16
  end
17
17
  end
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.7.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: 2021-08-06 00:00:00.000000000 Z
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.2
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