oas_rails 0.8.1 → 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: 05b39d8ca4348b3da83595a029b436a73ba17a7a6da61ff61b09c02dd6147e7f
4
- data.tar.gz: e8ef2175c8824dc45c63ef2aa112a1339ff5c4db779635ea4067d7bfd6dd75b8
3
+ metadata.gz: e9ec1769321b530eaf7d00f96827ac3062c4b7ba7a63eb88586bddf67d70dc56
4
+ data.tar.gz: d61cc8aaf523c8d260ffaf1e6d68810e9e68d275874fbbcc30cea8150f5f4b41
5
5
  SHA512:
6
- metadata.gz: a1cce603fbc0064bc84a3a953026aae6eb914b33872b20ebb1620195a4e4105736965c3816e664a708b4367adacce57d7003fb23646908f0ad5337f6a34fa5ee
7
- data.tar.gz: 070ec97c6bb4e46cfcd1f6f5b1d5a71fda212dd8d197c74623900ff057d614f2a387aa79c67eb7fd832bd7b36ae2fefd105b8159991263fd219b7a9718691e7a
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.1"
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.1
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-02 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
@@ -30,28 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.1.1
33
+ version: 0.1.2
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.1.1
41
- - !ruby/object:Gem::Dependency
42
- name: rails
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '7.0'
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '7.0'
40
+ version: 0.1.2
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: yard
57
43
  requirement: !ruby/object:Gem::Requirement
@@ -142,7 +128,7 @@ licenses:
142
128
  - GPL-3.0-only
143
129
  metadata:
144
130
  homepage_uri: https://github.com/a-chacon/oas_rails
145
- post_install_message:
131
+ post_install_message:
146
132
  rdoc_options: []
147
133
  require_paths:
148
134
  - lib
@@ -158,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
158
144
  version: '0'
159
145
  requirements: []
160
146
  rubygems_version: 3.5.11
161
- signing_key:
147
+ signing_key:
162
148
  specification_version: 4
163
149
  summary: OasRails is a Rails engine for generating automatic interactive documentation
164
150
  for your Rails APIs.