oas_rails 0.8.2 → 0.8.3

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: e9ec1769321b530eaf7d00f96827ac3062c4b7ba7a63eb88586bddf67d70dc56
4
+ data.tar.gz: d61cc8aaf523c8d260ffaf1e6d68810e9e68d275874fbbcc30cea8150f5f4b41
5
5
  SHA512:
6
- metadata.gz: 602eecab29188077b177d9db096c4273c100c6ff29c7e2c1d086ca3e0ba500861f89283c687a52ea3fff4ac9a5d096410694133a79da5549a7c7d03193582fef
7
- data.tar.gz: 014240210b412a6287b7fc9e17339e719ddca9639225f40cafee860ee5a5aa140e442a5068fd0e0034af53d905739052d8d435810ece7da667b69f9bf4f8e676
6
+ metadata.gz: 61da9b7abe2bdb8012c9a3c338820f208e73e386174c9e6903eaa01fc572adfb5caa825e273364a487dfd3638f8e8f75db710518dc0d4b391fd6f3dad997ec82
7
+ data.tar.gz: fc78d7790e5d584f12476baab723c97b74d704850f959db09e9e0c516d8b18bb621b7b0dcd0e1af43d919101c933ceccfcbaf8cdf886eff70aea46b1a36964e8
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
 
@@ -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.3"
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.3
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: 2024-12-21 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.