zero-rails_openapi 1.1.0 → 1.1.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
  SHA1:
3
- metadata.gz: 4b90e9497b858c621362ea5413020a64bdbd59de
4
- data.tar.gz: '067410229fdc842e1d2f65e3cf4fbb9482535044'
3
+ metadata.gz: 5c0a2065e4a332132fafda9c0b20dc1f10a87ba0
4
+ data.tar.gz: 8e232f1841f6489ec5fba6e9c3aaf56e0314e416
5
5
  SHA512:
6
- metadata.gz: eefc1f9b19e39b1a7aee1f9817c9860da02b77f4feb94a22a72fa8dd11739e9e9b1cda3d23404bfeaefbeba9fd3a9cd2c06898f92a31f14c60eae3c1788b5b61
7
- data.tar.gz: 1d5bf3b31a7e8ed246e50ecd63f869c0913185a0eb31c95490d32163f48ff5c0eba8e744ce4ec234ad72ff8821e3f246b515d0cec473cb3d4269eaf9c8bf11f5
6
+ metadata.gz: 24baf84b60c4e2b4a846d5284b34fef596444d1ee90f35fa537d2de87af6b7e35999b44e780db9fbd1a8450675bfe558d9b2d77a51774f120d8133d2fef08f8a
7
+ data.tar.gz: c238aa68acdc0be8a9d7c3482828ab7feedc69088161622bace745b801111bc28184a9a0612ccb774b5c6accf630e3258c86c88cf160a0e2ee9534544ddc2655
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- zero-rails_openapi (1.1.0)
4
+ zero-rails_openapi (1.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -14,16 +14,16 @@ but I dont have enough time now = ▽ =
14
14
 
15
15
  ## Table of Contents
16
16
 
17
- - [About OAS](https://github.com/zhandao/zero-rails_openapi#about-oas) (OpenAPI Specification)
18
- - [Installation](https://github.com/zhandao/zero-rails_openapi#installation)
19
- - [Configure](https://github.com/zhandao/zero-rails_openapi#configure)
20
- - [Usage](https://github.com/zhandao/zero-rails_openapi#usage)
21
- - [DSL for documenting your controller](https://github.com/zhandao/zero-rails_openapi#dsl-for-documenting-your-controller)
22
- - [Generate JSON Documentation File](https://github.com/zhandao/zero-rails_openapi#generate-json-documentation-file)
23
- - [Use Swagger UI(very beautiful web page) to show your Documentation](https://github.com/zhandao/zero-rails_openapi#use-swagger-uivery-beautiful-web-page-to-show-your-documentation)
17
+ - [About OAS](#about-oas) (OpenAPI Specification)
18
+ - [Installation](#installation)
19
+ - [Configure](#configure)
20
+ - [Usage](#usage)
21
+ - [DSL for documenting your controller](#dsl-for-documenting-your-controller)
22
+ - [Generate JSON Documentation File](#generate-json-documentation-file)
23
+ - [Use Swagger UI(very beautiful web page) to show your Documentation](#use-swagger-uivery-beautiful-web-page-to-show-your-documentation)
24
24
  - [Tricks](#tricks)
25
- - [Write the DSL Somewhere Else]
26
- - [Troubleshooting](https://github.com/zhandao/zero-rails_openapi#troubleshooting)
25
+ - [Write the DSL Somewhere Else](#write-the-dsl-somewhere-else)
26
+ - [Troubleshooting](#troubleshooting)
27
27
 
28
28
  ## About OAS
29
29
 
@@ -161,9 +161,9 @@ end
161
161
  ctrl_path 'api/v1/examples'
162
162
  ```
163
163
  This option allows you to set the Tag* (which is a node of [OpenApi Object](https://github.com/OAI/OpenAPI-Specification/blob/OpenAPI.next/versions/3.0.0.md#openapi-object)).
164
- [Here's a trick](): Using `ctrl_path`, you can write the DSL somewhere else
164
+ [Here's a trick](#write-the-dsl-somewhere-else-recommend): Using `ctrl_path`, you can write the DSL somewhere else
165
165
  to simplify the current controller.
166
- \* Take the tag from `path.split('/').last`
166
+ \* take the tag from `path.split('/').last`
167
167
 
168
168
  - `apis_set` [Optional]
169
169
 
@@ -395,7 +395,7 @@ In order to use it, you may have to enable CORS, [see](https://github.com/swagge
395
395
 
396
396
  ### Tricks
397
397
 
398
- #### Write the DSL Somewhere Else (Recommend)
398
+ #### Write the DSL Somewhere Else
399
399
 
400
400
  Does your documentation take too mant lines?
401
401
  Do you want to separate documentation from business controller to simplify both?
@@ -48,18 +48,20 @@ OpenApi.configure do |c|
48
48
  # https://swagger.io/docs/specification/api-host-and-base-path/
49
49
  # The servers section specifies the API server and base URL.
50
50
  # You can define one or several servers, such as production and sandbox.
51
- servers: [{
52
- # [REQUIRED] A URL to the target host.
53
- # This URL supports Server Variables and MAY be relative,
54
- # to indicate that the host location is relative to the location where
55
- # the OpenAPI document is being served.
56
- url: 'http://localhost:2333',
57
- # An optional string describing the host designated by the URL.
58
- description: 'Optional server description, e.g. Main (production) server'
59
- },{
60
- url: 'http://localhost:3332',
61
- description: 'Optional server description, e.g. Internal staging server for testing'
62
- }],
51
+ servers: [
52
+ {
53
+ # [REQUIRED] A URL to the target host.
54
+ # This URL supports Server Variables and MAY be relative,
55
+ # to indicate that the host location is relative to the location where
56
+ # the OpenAPI document is being served.
57
+ url: 'http://localhost:2333',
58
+ # An optional string describing the host designated by the URL.
59
+ description: 'Optional server description, e.g. Main (production) server'
60
+ },{
61
+ url: 'http://localhost:3332',
62
+ description: 'Optional server description, e.g. Internal staging server for testing'
63
+ }
64
+ ],
63
65
 
64
66
  # Authentication
65
67
  # The securitySchemes and security keywords are used to describe the authentication methods used in your API.
@@ -19,7 +19,7 @@ module OpenApi
19
19
 
20
20
  def process
21
21
  assign(_desc).to_processed 'description'
22
- processed.tap { |it| it[:schema] = schema.process_for name }
22
+ processed.tap { |it| it[:schema] = schema.process_for self[:name] }
23
23
  end
24
24
 
25
25
 
@@ -36,27 +36,6 @@ module OpenApi
36
36
  self[key]
37
37
  end
38
38
  end
39
-
40
-
41
- # Interfaces for directly taking the info what you focus on,
42
- # The next step you may want to verify the parameters based on these infos.
43
- # The implementation of the parameters validator, see:
44
- # TODO
45
- alias_method :range, :_range
46
- alias_method :length, :_length
47
- { # INTERFACE_MAPPING
48
- name: %i[name ],
49
- required: %i[required ],
50
- in: %i[in ],
51
- enum: %i[schema enum ],
52
- pattern: %i[schema pattern],
53
- regexp: %i[schema pattern],
54
- type: %i[schema type ],
55
- is: %i[schema format ],
56
- }.each do |method, path|
57
- define_method method do path.inject(processed, &:[]) end # Get value from hash by key path
58
- end
59
- alias_method :required?, :required
60
39
  end
61
40
  end
62
41
  end
@@ -141,12 +141,11 @@ module OpenApi
141
141
  _default: %i[default dft default_value ],
142
142
  }.each do |key, aliases|
143
143
  define_method key do
144
- self[key].tap do |it|
145
- aliases.each do |alias_name|
146
- break if it == false
147
- it ||= self[alias_name]
148
- end if it.nil?
149
- end
144
+ aliases.each do |alias_name|
145
+ break if self[key] == false
146
+ self[key] ||= self[alias_name]
147
+ end if self[key].nil?
148
+ self[key]
150
149
  end
151
150
  define_method "#{key}=" do |value| self[key] = value end
152
151
  end
@@ -45,6 +45,7 @@ module OpenApi
45
45
  docs.each do |api_name, doc|
46
46
  File.open("#{output_path}/#{api_name}.json", 'w') { |file| file.write JSON.pretty_generate doc }
47
47
  end
48
+ # pp $open_apis
48
49
  end
49
50
  end
50
51
 
@@ -1,3 +1,3 @@
1
1
  module OpenApi
2
- VERSION = '1.1.0'
2
+ VERSION = '1.1.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zero-rails_openapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - zhandao
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-09-27 00:00:00.000000000 Z
11
+ date: 2017-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler