betterdocs 0.8.0 → 0.8.1

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: 7324105b58e4926bdbcec0e372efda88e523c1c31fb4f0181e9d4cebc94b135c
4
- data.tar.gz: 6926a2ea9814cae5e763113badf138104f2fd9ae250c57e9cc8a16fb6eb18d43
3
+ metadata.gz: 7a2bc56272804e559e0b5c236e3bdd40aff7e127b31b34c5591b3c9a233c610d
4
+ data.tar.gz: a51d33e38bb1f75412c3bf2f77956e6974226db537059d049999bd9889e5ea40
5
5
  SHA512:
6
- metadata.gz: ccaab04fbb9dfc351d79b9b722d1430c1a8afc5007f3f8bfd68d2d7d1c06ab4d26cf843e745750d1eb805b3d83122fb6b48597a8c1a3bc127fee5bc95e43443e
7
- data.tar.gz: 67968de292f5c9e0d17b0d2669d72ca75f1e6d709ea219de4f36beab3b99e14452dfa626ff4cb0fe6222419ba99e19f3be4f4765242dbd8d9f0622839d150cf9
6
+ metadata.gz: 263a170adbde71f93ec60701e2e8f2b3c017f2051d384a491cf789497ff55ec0718b7c383534f296d3746c24fb93b6029e671897270726adbf703a445761adf2
7
+ data.tar.gz: 75677987041d464d1792e97f7ac65201992cd8c8af89e93ce742970e4410f985dae62d1c0ae9ecc9b964025814aad45b4236bf5a9230f3063d352a1e94273734
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.8.0
1
+ 0.7.1
data/betterdocs.gemspec CHANGED
@@ -1,49 +1,49 @@
1
- # -*- encoding: utf-8 -*-
2
- # stub: betterdocs 0.8.0 ruby lib
1
+ # stub: betterdocs 0.7.1 ruby lib
3
2
 
4
3
  Gem::Specification.new do |s|
5
- s.name = "betterdocs".freeze
6
- s.version = "0.8.0"
4
+ s.name = 'betterdocs'.freeze
5
+ s.version = '0.8.1'
7
6
 
8
- s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
9
- s.require_paths = ["lib".freeze]
10
- s.authors = ["betterplace Developers".freeze]
11
- s.date = "2021-07-07"
7
+ s.required_rubygems_version = Gem::Requirement.new('>= 0'.freeze) if s.respond_to? :required_rubygems_version=
8
+ s.require_paths = ['lib'.freeze]
9
+ s.authors = ['betterplace Developers'.freeze]
10
+ s.date = '2021-07-07'
12
11
  s.description = "This library provides tools to generate API documention for a web site's REST-ful JSON API.".freeze
13
- s.email = "developers@betterplace.org".freeze
14
- s.extra_rdoc_files = ["README.md".freeze, "lib/betterdocs.rb".freeze, "lib/betterdocs/controller_collector.rb".freeze, "lib/betterdocs/dsl.rb".freeze, "lib/betterdocs/dsl/common.rb".freeze, "lib/betterdocs/dsl/controller.rb".freeze, "lib/betterdocs/dsl/controller/action.rb".freeze, "lib/betterdocs/dsl/controller/action/param.rb".freeze, "lib/betterdocs/dsl/controller/action/response.rb".freeze, "lib/betterdocs/dsl/controller/controller.rb".freeze, "lib/betterdocs/dsl/controller/controller_base.rb".freeze, "lib/betterdocs/dsl/json_params.rb".freeze, "lib/betterdocs/dsl/json_params/param.rb".freeze, "lib/betterdocs/dsl/json_type_mapper.rb".freeze, "lib/betterdocs/dsl/naming.rb".freeze, "lib/betterdocs/dsl/representer.rb".freeze, "lib/betterdocs/dsl/result.rb".freeze, "lib/betterdocs/dsl/result/collection_property.rb".freeze, "lib/betterdocs/dsl/result/link.rb".freeze, "lib/betterdocs/dsl/result/property.rb".freeze, "lib/betterdocs/generator/config_shortcuts.rb".freeze, "lib/betterdocs/generator/markdown.rb".freeze, "lib/betterdocs/generator/swagger.rb".freeze, "lib/betterdocs/global.rb".freeze, "lib/betterdocs/json_params_representer.rb".freeze, "lib/betterdocs/json_params_representer_collector.rb".freeze, "lib/betterdocs/json_time_with_zone.rb".freeze, "lib/betterdocs/mix_into_controller.rb".freeze, "lib/betterdocs/railtie.rb".freeze, "lib/betterdocs/rake_tasks.rb".freeze, "lib/betterdocs/representer.rb".freeze, "lib/betterdocs/result_representer.rb".freeze, "lib/betterdocs/result_representer_collector.rb".freeze, "lib/betterdocs/sanitizer.rb".freeze, "lib/betterdocs/section.rb".freeze, "lib/betterdocs/version.rb".freeze]
15
- s.files = [".codeclimate.yml".freeze, ".gitignore".freeze, ".rspec".freeze, ".semaphore/semaphore.yml".freeze, ".tool-versions".freeze, ".vscode/settings.json".freeze, "COPYING".freeze, "Gemfile".freeze, "LICENSE".freeze, "README.md".freeze, "Rakefile".freeze, "VERSION".freeze, "betterdocs.gemspec".freeze, "lib/betterdocs.rb".freeze, "lib/betterdocs/controller_collector.rb".freeze, "lib/betterdocs/dsl.rb".freeze, "lib/betterdocs/dsl/common.rb".freeze, "lib/betterdocs/dsl/controller.rb".freeze, "lib/betterdocs/dsl/controller/action.rb".freeze, "lib/betterdocs/dsl/controller/action/param.rb".freeze, "lib/betterdocs/dsl/controller/action/response.rb".freeze, "lib/betterdocs/dsl/controller/controller.rb".freeze, "lib/betterdocs/dsl/controller/controller_base.rb".freeze, "lib/betterdocs/dsl/json_params.rb".freeze, "lib/betterdocs/dsl/json_params/param.rb".freeze, "lib/betterdocs/dsl/json_type_mapper.rb".freeze, "lib/betterdocs/dsl/naming.rb".freeze, "lib/betterdocs/dsl/representer.rb".freeze, "lib/betterdocs/dsl/result.rb".freeze, "lib/betterdocs/dsl/result/collection_property.rb".freeze, "lib/betterdocs/dsl/result/link.rb".freeze, "lib/betterdocs/dsl/result/property.rb".freeze, "lib/betterdocs/generator/config_shortcuts.rb".freeze, "lib/betterdocs/generator/markdown.rb".freeze, "lib/betterdocs/generator/markdown/templates/README.md.erb".freeze, "lib/betterdocs/generator/markdown/templates/section.md.erb".freeze, "lib/betterdocs/generator/swagger.rb".freeze, "lib/betterdocs/generator/swagger_static/index.html".freeze, "lib/betterdocs/global.rb".freeze, "lib/betterdocs/json_params_representer.rb".freeze, "lib/betterdocs/json_params_representer_collector.rb".freeze, "lib/betterdocs/json_time_with_zone.rb".freeze, "lib/betterdocs/mix_into_controller.rb".freeze, "lib/betterdocs/railtie.rb".freeze, "lib/betterdocs/rake_tasks.rb".freeze, "lib/betterdocs/representer.rb".freeze, "lib/betterdocs/result_representer.rb".freeze, "lib/betterdocs/result_representer_collector.rb".freeze, "lib/betterdocs/sanitizer.rb".freeze, "lib/betterdocs/section.rb".freeze, "lib/betterdocs/tasks/doc.rake".freeze, "lib/betterdocs/version.rb".freeze, "spec/assets/app/assets/images/logos/logo.png".freeze, "spec/assets/app/controllers/api/foos_controller.rb".freeze, "spec/assets/app/views/api_v4/documentation/assets/CHANGELOG.md".freeze, "spec/assets/config/betterdocs.yml".freeze, "spec/betterdocs/dsl/controller/action/param_spec.rb".freeze, "spec/betterdocs/dsl/controller/action/response_spec.rb".freeze, "spec/betterdocs/dsl/json_type_mapper_spec.rb".freeze, "spec/betterdocs/dsl/result/collection_property_spec.rb".freeze, "spec/betterdocs/dsl/result/link_spec.rb".freeze, "spec/betterdocs/dsl/result/property_spec.rb".freeze, "spec/betterdocs/generator/markdown_spec.rb".freeze, "spec/betterdocs/global_spec.rb".freeze, "spec/betterdocs/json_params_representer_spec.rb".freeze, "spec/betterdocs/result_representer_spec.rb".freeze, "spec/betterdocs/sanitizer_spec.rb".freeze, "spec/controller_dsl_spec.rb".freeze, "spec/result_representer_dsl_spec.rb".freeze, "spec/spec_helper.rb".freeze]
16
- s.homepage = "http://github.com/betterplace/betterdocs".freeze
17
- s.rdoc_options = ["--title".freeze, "Betterdocs".freeze, "--main".freeze, "README.md".freeze]
18
- s.rubygems_version = "3.2.15".freeze
19
- s.summary = "Betterplace API documentation library".freeze
20
- s.test_files = ["spec/assets/app/controllers/api/foos_controller.rb".freeze, "spec/betterdocs/dsl/controller/action/param_spec.rb".freeze, "spec/betterdocs/dsl/controller/action/response_spec.rb".freeze, "spec/betterdocs/dsl/json_type_mapper_spec.rb".freeze, "spec/betterdocs/dsl/result/collection_property_spec.rb".freeze, "spec/betterdocs/dsl/result/link_spec.rb".freeze, "spec/betterdocs/dsl/result/property_spec.rb".freeze, "spec/betterdocs/generator/markdown_spec.rb".freeze, "spec/betterdocs/global_spec.rb".freeze, "spec/betterdocs/json_params_representer_spec.rb".freeze, "spec/betterdocs/result_representer_spec.rb".freeze, "spec/betterdocs/sanitizer_spec.rb".freeze, "spec/controller_dsl_spec.rb".freeze, "spec/result_representer_dsl_spec.rb".freeze, "spec/spec_helper.rb".freeze]
12
+ s.email = 'developers@betterplace.org'.freeze
13
+ s.extra_rdoc_files = ['README.md'.freeze, 'lib/betterdocs.rb'.freeze,
14
+ 'lib/betterdocs/controller_collector.rb'.freeze, 'lib/betterdocs/dsl.rb'.freeze, 'lib/betterdocs/dsl/common.rb'.freeze, 'lib/betterdocs/dsl/controller.rb'.freeze, 'lib/betterdocs/dsl/controller/action.rb'.freeze, 'lib/betterdocs/dsl/controller/action/param.rb'.freeze, 'lib/betterdocs/dsl/controller/action/response.rb'.freeze, 'lib/betterdocs/dsl/controller/controller.rb'.freeze, 'lib/betterdocs/dsl/controller/controller_base.rb'.freeze, 'lib/betterdocs/dsl/json_params.rb'.freeze, 'lib/betterdocs/dsl/json_params/param.rb'.freeze, 'lib/betterdocs/dsl/json_type_mapper.rb'.freeze, 'lib/betterdocs/dsl/naming.rb'.freeze, 'lib/betterdocs/dsl/representer.rb'.freeze, 'lib/betterdocs/dsl/result.rb'.freeze, 'lib/betterdocs/dsl/result/collection_property.rb'.freeze, 'lib/betterdocs/dsl/result/link.rb'.freeze, 'lib/betterdocs/dsl/result/property.rb'.freeze, 'lib/betterdocs/generator/config_shortcuts.rb'.freeze, 'lib/betterdocs/generator/markdown.rb'.freeze, 'lib/betterdocs/generator/swagger.rb'.freeze, 'lib/betterdocs/global.rb'.freeze, 'lib/betterdocs/json_params_representer.rb'.freeze, 'lib/betterdocs/json_params_representer_collector.rb'.freeze, 'lib/betterdocs/json_time_with_zone.rb'.freeze, 'lib/betterdocs/mix_into_controller.rb'.freeze, 'lib/betterdocs/railtie.rb'.freeze, 'lib/betterdocs/rake_tasks.rb'.freeze, 'lib/betterdocs/representer.rb'.freeze, 'lib/betterdocs/result_representer.rb'.freeze, 'lib/betterdocs/result_representer_collector.rb'.freeze, 'lib/betterdocs/sanitizer.rb'.freeze, 'lib/betterdocs/section.rb'.freeze, 'lib/betterdocs/version.rb'.freeze]
15
+ s.files = ['.codeclimate.yml'.freeze, '.gitignore'.freeze, '.rspec'.freeze, '.semaphore/semaphore.yml'.freeze,
16
+ '.tool-versions'.freeze, '.vscode/settings.json'.freeze, 'COPYING'.freeze, 'Gemfile'.freeze, 'LICENSE'.freeze, 'README.md'.freeze, 'Rakefile'.freeze, 'VERSION'.freeze, 'betterdocs.gemspec'.freeze, 'lib/betterdocs.rb'.freeze, 'lib/betterdocs/controller_collector.rb'.freeze, 'lib/betterdocs/dsl.rb'.freeze, 'lib/betterdocs/dsl/common.rb'.freeze, 'lib/betterdocs/dsl/controller.rb'.freeze, 'lib/betterdocs/dsl/controller/action.rb'.freeze, 'lib/betterdocs/dsl/controller/action/param.rb'.freeze, 'lib/betterdocs/dsl/controller/action/response.rb'.freeze, 'lib/betterdocs/dsl/controller/controller.rb'.freeze, 'lib/betterdocs/dsl/controller/controller_base.rb'.freeze, 'lib/betterdocs/dsl/json_params.rb'.freeze, 'lib/betterdocs/dsl/json_params/param.rb'.freeze, 'lib/betterdocs/dsl/json_type_mapper.rb'.freeze, 'lib/betterdocs/dsl/naming.rb'.freeze, 'lib/betterdocs/dsl/representer.rb'.freeze, 'lib/betterdocs/dsl/result.rb'.freeze, 'lib/betterdocs/dsl/result/collection_property.rb'.freeze, 'lib/betterdocs/dsl/result/link.rb'.freeze, 'lib/betterdocs/dsl/result/property.rb'.freeze, 'lib/betterdocs/generator/config_shortcuts.rb'.freeze, 'lib/betterdocs/generator/markdown.rb'.freeze, 'lib/betterdocs/generator/markdown/templates/README.md.erb'.freeze, 'lib/betterdocs/generator/markdown/templates/section.md.erb'.freeze, 'lib/betterdocs/generator/swagger.rb'.freeze, 'lib/betterdocs/generator/swagger_static/index.html'.freeze, 'lib/betterdocs/global.rb'.freeze, 'lib/betterdocs/json_params_representer.rb'.freeze, 'lib/betterdocs/json_params_representer_collector.rb'.freeze, 'lib/betterdocs/json_time_with_zone.rb'.freeze, 'lib/betterdocs/mix_into_controller.rb'.freeze, 'lib/betterdocs/railtie.rb'.freeze, 'lib/betterdocs/rake_tasks.rb'.freeze, 'lib/betterdocs/representer.rb'.freeze, 'lib/betterdocs/result_representer.rb'.freeze, 'lib/betterdocs/result_representer_collector.rb'.freeze, 'lib/betterdocs/sanitizer.rb'.freeze, 'lib/betterdocs/section.rb'.freeze, 'lib/betterdocs/tasks/doc.rake'.freeze, 'lib/betterdocs/version.rb'.freeze, 'spec/assets/app/assets/images/logos/logo.png'.freeze, 'spec/assets/app/controllers/api/foos_controller.rb'.freeze, 'spec/assets/app/views/api_v4/documentation/assets/CHANGELOG.md'.freeze, 'spec/assets/config/betterdocs.yml'.freeze, 'spec/betterdocs/dsl/controller/action/param_spec.rb'.freeze, 'spec/betterdocs/dsl/controller/action/response_spec.rb'.freeze, 'spec/betterdocs/dsl/json_type_mapper_spec.rb'.freeze, 'spec/betterdocs/dsl/result/collection_property_spec.rb'.freeze, 'spec/betterdocs/dsl/result/link_spec.rb'.freeze, 'spec/betterdocs/dsl/result/property_spec.rb'.freeze, 'spec/betterdocs/generator/markdown_spec.rb'.freeze, 'spec/betterdocs/global_spec.rb'.freeze, 'spec/betterdocs/json_params_representer_spec.rb'.freeze, 'spec/betterdocs/result_representer_spec.rb'.freeze, 'spec/betterdocs/sanitizer_spec.rb'.freeze, 'spec/controller_dsl_spec.rb'.freeze, 'spec/result_representer_dsl_spec.rb'.freeze, 'spec/spec_helper.rb'.freeze]
17
+ s.homepage = 'http://github.com/betterplace/betterdocs'.freeze
18
+ s.rdoc_options = ['--title'.freeze, 'Betterdocs'.freeze, '--main'.freeze, 'README.md'.freeze]
19
+ s.rubygems_version = '3.2.15'.freeze
20
+ s.summary = 'Betterplace API documentation library'.freeze
21
+ s.test_files = ['spec/assets/app/controllers/api/foos_controller.rb'.freeze,
22
+ 'spec/betterdocs/dsl/controller/action/param_spec.rb'.freeze, 'spec/betterdocs/dsl/controller/action/response_spec.rb'.freeze, 'spec/betterdocs/dsl/json_type_mapper_spec.rb'.freeze, 'spec/betterdocs/dsl/result/collection_property_spec.rb'.freeze, 'spec/betterdocs/dsl/result/link_spec.rb'.freeze, 'spec/betterdocs/dsl/result/property_spec.rb'.freeze, 'spec/betterdocs/generator/markdown_spec.rb'.freeze, 'spec/betterdocs/global_spec.rb'.freeze, 'spec/betterdocs/json_params_representer_spec.rb'.freeze, 'spec/betterdocs/result_representer_spec.rb'.freeze, 'spec/betterdocs/sanitizer_spec.rb'.freeze, 'spec/controller_dsl_spec.rb'.freeze, 'spec/result_representer_dsl_spec.rb'.freeze, 'spec/spec_helper.rb'.freeze]
21
23
 
22
- if s.respond_to? :specification_version then
23
- s.specification_version = 4
24
- end
24
+ s.specification_version = 4 if s.respond_to? :specification_version
25
25
 
26
- if s.respond_to? :add_runtime_dependency then
27
- s.add_development_dependency(%q<gem_hadar>.freeze, ["~> 1.11.0"])
28
- s.add_development_dependency(%q<rake>.freeze, [">= 0"])
29
- s.add_development_dependency(%q<simplecov>.freeze, [">= 0"])
30
- s.add_development_dependency(%q<rspec>.freeze, [">= 0"])
31
- s.add_runtime_dependency(%q<tins>.freeze, ["~> 1.3", ">= 1.3.5"])
32
- s.add_runtime_dependency(%q<rails>.freeze, [">= 3", "< 7"])
33
- s.add_runtime_dependency(%q<term-ansicolor>.freeze, ["~> 1.3"])
34
- s.add_runtime_dependency(%q<complex_config>.freeze, ["~> 0.5"])
35
- s.add_runtime_dependency(%q<infobar>.freeze, [">= 0"])
36
- s.add_runtime_dependency(%q<mize>.freeze, [">= 0"])
26
+ if s.respond_to? :add_runtime_dependency
27
+ s.add_development_dependency('gem_hadar'.freeze, ['~> 1.11.0'])
28
+ s.add_development_dependency('rake'.freeze, ['>= 0'])
29
+ s.add_development_dependency('simplecov'.freeze, ['>= 0'])
30
+ s.add_development_dependency('rspec'.freeze, ['>= 0'])
31
+ s.add_runtime_dependency('tins'.freeze, ['~> 1.3', '>= 1.3.5'])
32
+ s.add_runtime_dependency('rails'.freeze, ['>= 3', '< 7'])
33
+ s.add_runtime_dependency('term-ansicolor'.freeze, ['~> 1.3'])
34
+ s.add_runtime_dependency('complex_config'.freeze, ['~> 0.5'])
35
+ s.add_runtime_dependency('infobar'.freeze, ['>= 0'])
36
+ s.add_runtime_dependency('mize'.freeze, ['>= 0'])
37
37
  else
38
- s.add_dependency(%q<gem_hadar>.freeze, ["~> 1.11.0"])
39
- s.add_dependency(%q<rake>.freeze, [">= 0"])
40
- s.add_dependency(%q<simplecov>.freeze, [">= 0"])
41
- s.add_dependency(%q<rspec>.freeze, [">= 0"])
42
- s.add_dependency(%q<tins>.freeze, ["~> 1.3", ">= 1.3.5"])
43
- s.add_dependency(%q<rails>.freeze, [">= 3", "< 7"])
44
- s.add_dependency(%q<term-ansicolor>.freeze, ["~> 1.3"])
45
- s.add_dependency(%q<complex_config>.freeze, ["~> 0.5"])
46
- s.add_dependency(%q<infobar>.freeze, [">= 0"])
47
- s.add_dependency(%q<mize>.freeze, [">= 0"])
38
+ s.add_dependency('gem_hadar'.freeze, ['~> 1.11.0'])
39
+ s.add_dependency('rake'.freeze, ['>= 0'])
40
+ s.add_dependency('simplecov'.freeze, ['>= 0'])
41
+ s.add_dependency('rspec'.freeze, ['>= 0'])
42
+ s.add_dependency('tins'.freeze, ['~> 1.3', '>= 1.3.5'])
43
+ s.add_dependency('rails'.freeze, ['>= 3', '< 7'])
44
+ s.add_dependency('term-ansicolor'.freeze, ['~> 1.3'])
45
+ s.add_dependency('complex_config'.freeze, ['~> 0.5'])
46
+ s.add_dependency('infobar'.freeze, ['>= 0'])
47
+ s.add_dependency('mize'.freeze, ['>= 0'])
48
48
  end
49
49
  end
@@ -18,6 +18,8 @@ class Betterdocs::Dsl::Result::Property < Betterdocs::Dsl::Representer
18
18
 
19
19
  dsl_accessor :types
20
20
 
21
+ dsl_accessor :optional
22
+
21
23
  dsl_accessor :sanitize do Betterdocs::Global.default_sanitize end
22
24
 
23
25
  def initialize(representer, name, options, &block)
@@ -39,7 +39,7 @@ module Betterdocs
39
39
  Betterdocs.rails.configuration.action_controller.asset_host = Betterdocs::Global.asset_host
40
40
  options = {
41
41
  host: Betterdocs::Global.api_host,
42
- protocol: Betterdocs::Global.api_protocol,
42
+ protocol: Betterdocs::Global.api_protocol
43
43
  }
44
44
  infobar.puts color(40, "Setting default_url_options to #{options.inspect}.")
45
45
  Betterdocs.rails.application.routes.default_url_options = options
@@ -58,7 +58,7 @@ module Betterdocs
58
58
  sections.values.each do |section|
59
59
  infobar.progress(
60
60
  message: " Section #{section.name.to_s.inspect} %c/%t in %te ETA %e @%E ",
61
- force: true,
61
+ force: true
62
62
  )
63
63
  @only =~ section.name or next if @only
64
64
 
@@ -74,7 +74,7 @@ module Betterdocs
74
74
  config.each_swagger_asset do |src, dst|
75
75
  infobar.progress(
76
76
  message: " Asset #{File.basename(src).inspect} %c/%t in %te ETA %e @%E ",
77
- force: true,
77
+ force: true
78
78
  )
79
79
  mkdir_p File.dirname(dst)
80
80
  cp Betterdocs.rails.root.join(src), dst
@@ -125,9 +125,9 @@ module Betterdocs
125
125
  offset: { type: 'integer' },
126
126
  total_pages: { type: 'integer' },
127
127
  current_page: { type: 'integer' },
128
- per_page: { type: 'integer' },
128
+ per_page: { type: 'integer' }
129
129
  },
130
- required: %w[total_entries offset current_page per_page total_pages data],
130
+ required: %w[total_entries offset current_page per_page total_pages data]
131
131
  }
132
132
  end
133
133
 
@@ -159,9 +159,9 @@ module Betterdocs
159
159
  backtrace: { type: 'array', items: { type: 'string' } },
160
160
  message: { type: 'string' },
161
161
  errors: { type: 'object' },
162
- links: { type: 'array', items: { type: 'string' } },
162
+ links: { type: 'array', items: { type: 'string' } }
163
163
  },
164
- required: %w[name status status_code reason backtrace message links],
164
+ required: %w[name status status_code reason backtrace message links]
165
165
  }
166
166
  end
167
167
 
@@ -198,7 +198,7 @@ module Betterdocs
198
198
  def get_request_definition(params)
199
199
  schema = { type: 'object', properties: {}, required: [] }
200
200
  params.each do |param|
201
- schema[:properties][param.name] = get_schema(param.types, nil, param.description)
201
+ schema[:properties][param.name] = get_schema(param.types, nil, param.description, nil)
202
202
  schema[:required].push(param.name) if param.required == true || param.required == 'yes'
203
203
  end
204
204
  schema
@@ -237,10 +237,10 @@ module Betterdocs
237
237
  description.include?('DEPRECATED')
238
238
  end
239
239
 
240
- def get_schema(types, sub_cls, description)
240
+ def get_schema(types, sub_cls, description, optional)
241
241
  type, nullable = get_type(types)
242
242
  deprecated = get_deprecated_from_description(description)
243
- res = { description: description, type: type, nullable: nullable, deprecated: deprecated }
243
+ res = { description: description, type: type, nullable: nullable, deprecated: deprecated, optional: optional }
244
244
  case type
245
245
  when 'array'
246
246
  items = { type: 'string' }
@@ -269,9 +269,10 @@ module Betterdocs
269
269
  properties: {
270
270
  rel: { type: 'string', enum: [] },
271
271
  href: { type: 'string' },
272
+ templated: { type: 'boolean' }
272
273
  },
273
- required: %w[rel href],
274
- },
274
+ required: %w[rel href]
275
+ }
275
276
  }
276
277
  enum = definition[:properties][:links][:items][:properties][:rel][:enum]
277
278
  enum.push(value) unless enum.include?(value)
@@ -291,7 +292,8 @@ module Betterdocs
291
292
  sub_cls = get_dto_name(subs[p.nesting_name])
292
293
  cls = sub_cls || resp_cls
293
294
  definition = initialise_definition(definitions, cls)
294
- definition[:properties][p.public_name] = get_schema(p.types, get_dto_name(p.sub_representer?), p.description)
295
+ definition[:properties][p.public_name] =
296
+ get_schema(p.types, get_dto_name(p.sub_representer?), p.description, p.optional)
295
297
  end
296
298
  (response.full?(:links) || []).each do |l|
297
299
  sub_cls = get_dto_name(subs[l.nesting_name])
@@ -302,13 +304,16 @@ module Betterdocs
302
304
 
303
305
  def get_schema_ref(name)
304
306
  {
305
- "$ref": "#/components/schemas/#{name}",
307
+ "$ref": "#/components/schemas/#{name}"
306
308
  }
307
309
  end
308
310
 
309
311
  def add_required_to_definitions(definitions)
310
312
  definitions.each do |def_key, d|
311
- req = d[:properties].select { |_k, v| v.key?(:nullable) }.keys
313
+ req = d[:properties].select { |_k, v| v.key?(:nullable) && !v[:optional] }.keys
314
+ d[:properties].each do |p|
315
+ p.delete(:optional)
316
+ end
312
317
  definitions[def_key][:required] = req unless req.empty?
313
318
  end
314
319
  end
@@ -1,6 +1,6 @@
1
1
  module Betterdocs
2
2
  # Betterdocs version
3
- VERSION = '0.8.0'
3
+ VERSION = '0.7.1'
4
4
  VERSION_ARRAY = VERSION.split('.').map(&:to_i) # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: betterdocs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - betterplace Developers
@@ -297,7 +297,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
297
297
  - !ruby/object:Gem::Version
298
298
  version: '0'
299
299
  requirements: []
300
- rubygems_version: 3.2.15
300
+ rubygems_version: 3.2.17
301
301
  signing_key:
302
302
  specification_version: 4
303
303
  summary: Betterplace API documentation library