oas_rails 0.8.2 → 0.8.4

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: c70c07ca9ad5ffa9227f3364f4df02846b3f713c2deebd06494c18b073efc907
4
- data.tar.gz: 9375d6ea03cd901721987b627ded0a0dbdbfb064e83f84bb1a59e4d2c99da3ea
3
+ metadata.gz: 332f05d28a00e139df0d677f1fc187def7757e93543f9095d4e834d1cd65cccd
4
+ data.tar.gz: 41e70d4a52a5d3cf134846a9bcbe9b4c86f4fafb4cfea4e74dacdc8591c818dc
5
5
  SHA512:
6
- metadata.gz: 602eecab29188077b177d9db096c4273c100c6ff29c7e2c1d086ca3e0ba500861f89283c687a52ea3fff4ac9a5d096410694133a79da5549a7c7d03193582fef
7
- data.tar.gz: 014240210b412a6287b7fc9e17339e719ddca9639225f40cafee860ee5a5aa140e442a5068fd0e0034af53d905739052d8d435810ece7da667b69f9bf4f8e676
6
+ metadata.gz: 94c4b02f0c647c39c96e84e05b90486115afd2f72e11ffafec550b96d1deb4d98ae978063260b8d7f9a76a9d23f64c480bc235b0bcac61bfa7ba84d80f83cdf1
7
+ data.tar.gz: a61c8a315b1924be46ac68478d795d9c69539a1831364ec05aa82f7200d0f18549ba09e3933338e2d50977cb9230c5f9e49b77dcf2e12d6905f9c4c683647a48
data/README.md CHANGED
@@ -112,6 +112,8 @@ Then fill it with your data. Below are the available configuration options:
112
112
  - `config.autodiscover_responses`: Automatically detects responses from controller renders. Default is `true`.
113
113
  - `config.api_path`: Sets the API path if your API is under a different namespace.
114
114
  - `config.ignored_actions`: Sets an array with the controller or controller#action. No necessary to add api_path before.
115
+ - `config.http_verbs`: Defaults to `[:get, :post, :put, :patch, :delete]`
116
+ - `config.use_model_names`: Use model names when possible, defaults to `false`
115
117
 
116
118
  ### Authentication Settings
117
119
 
@@ -13,3 +13,7 @@
13
13
  allow-spec-file-download="true"
14
14
  >
15
15
  </rapi-doc>
16
+
17
+ <style>
18
+ rapi-doc::part(btn btn-outline){ width: 220px; min-width: 170px; }
19
+ </style>
@@ -11,7 +11,9 @@ module OasRails
11
11
  :authenticate_all_routes_by_default,
12
12
  :set_default_responses,
13
13
  :possible_default_responses,
14
- :response_body_of_default
14
+ :response_body_of_default,
15
+ :http_verbs,
16
+ :use_model_names
15
17
  attr_reader :servers, :tags, :security_schema
16
18
 
17
19
  def initialize
@@ -30,7 +32,9 @@ module OasRails
30
32
  @security_schemas = {}
31
33
  @set_default_responses = true
32
34
  @possible_default_responses = [:not_found, :unauthorized, :forbidden]
35
+ @http_verbs = [:get, :post, :put, :patch, :delete]
33
36
  @response_body_of_default = "Hash{ success: !Boolean, message: String }"
37
+ @use_model_names = false
34
38
  end
35
39
 
36
40
  def security_schema=(value)
@@ -44,9 +44,20 @@ module OasRails
44
44
  end
45
45
 
46
46
  def add_schema(schema)
47
- key = Hashable.generate_hash(schema)
48
- @schemas[key] = schema if @schemas[key].nil?
47
+ key = nil
48
+ if OasRails.config.use_model_names
49
+ if schema[:type] == 'array'
50
+ arr_schema = schema[:items]
51
+ arr_key = arr_schema['title']
52
+ key = "#{arr_key}List" unless arr_key.nil?
53
+ else
54
+ key = schema['title']
55
+ end
56
+ end
57
+
58
+ key = Hashable.generate_hash(schema) if key.nil?
49
59
 
60
+ @schemas[key] = schema if @schemas[key].nil?
50
61
  schema_reference(key)
51
62
  end
52
63
 
@@ -26,7 +26,7 @@ module OasRails
26
26
  end
27
27
 
28
28
  def oas_fields
29
- [:get, :post, :put, :patch, :delete]
29
+ OasRails.config.http_verbs
30
30
  end
31
31
  end
32
32
  end
@@ -1,3 +1,3 @@
1
1
  module OasRails
2
- VERSION = "0.8.2"
2
+ VERSION = "0.8.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oas_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.2
4
+ version: 0.8.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - a-chacon
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-11 00:00:00.000000000 Z
11
+ date: 2025-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: method_source
@@ -128,7 +128,7 @@ licenses:
128
128
  - GPL-3.0-only
129
129
  metadata:
130
130
  homepage_uri: https://github.com/a-chacon/oas_rails
131
- post_install_message:
131
+ post_install_message:
132
132
  rdoc_options: []
133
133
  require_paths:
134
134
  - lib
@@ -144,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
144
  version: '0'
145
145
  requirements: []
146
146
  rubygems_version: 3.5.11
147
- signing_key:
147
+ signing_key:
148
148
  specification_version: 4
149
149
  summary: OasRails is a Rails engine for generating automatic interactive documentation
150
150
  for your Rails APIs.