swagger_yard 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
  SHA256:
3
- metadata.gz: 92fee53b6f39a4a44e733619571d5c051054df3e7721058b50d6f18654898d73
4
- data.tar.gz: 93e2c4acd9fb8c523a39c916257e41a5c6426e5033439f814223d91397317606
3
+ metadata.gz: 503b5e749f9f3e40431798185264f5d830923d1117eaf19e53ffa4069b4db54e
4
+ data.tar.gz: 748debe18cb7958200d2e690ab7b6e0b36ef153bfcdb48c5283bb0687ba57246
5
5
  SHA512:
6
- metadata.gz: 23e2f8c39bdaf2a8009dc7f78b4a8f589da25737fa4cb3e77ab89395abe84459a52106d85aa026b533bbefdfe646cfa9c7fc7d9ede512be5edd4e242ada164ba
7
- data.tar.gz: b893eddf59099d0fc2cba25486d5e7b2073b2386d3e0805addf7f7d2b280ccdd165038cd5323ab5315ecd8ac7a5ad07b0b6541471c6c14f7ff5890309de313cf
6
+ metadata.gz: ace4ee34ecfa50bb06376789fed0770f52c7c58367452db1f701a69a29564c2a609c5d07b51d571c796f5820a80453f0382b81821bcb525bfa48cdf707195599
7
+ data.tar.gz: e7aa50665d8d8ef371414e885bce55986819be74fe782e4576b8d1c129539f7638c6c3767f85d56ec3ff8919c4d45d42d8162ae162514723b02de60d46e39614
data/README.md CHANGED
@@ -32,6 +32,11 @@ Place configuration in a Rails initializer or suitable configuration file:
32
32
 
33
33
  # Where to find models (can be an array)
34
34
  config.model_path = ::Rails.root + 'app/decorators/**/*'
35
+
36
+ # Whether to include controller methods marked as private
37
+ # (either with ruby `private` or YARD `# @visibility private`
38
+ # Default: true
39
+ config.include_private = true
35
40
  end
36
41
 
37
42
  Then start to annotate controllers and models as described below.
@@ -108,6 +113,18 @@ class Accounts::OwnershipsController < ActionController::Base
108
113
  end
109
114
  ```
110
115
 
116
+ #### Private controllers/actions
117
+
118
+ When you set `include_private = false` in the SwaggerYard configuration, you can mark action methods as private, so that they won't be documented, using `@visibility private` in comments.
119
+
120
+ ```ruby
121
+ ##
122
+ # @visibility private
123
+ def show
124
+ end
125
+ ```
126
+
127
+
111
128
  ### Model ###
112
129
 
113
130
  Each model to be exposed in the specification must have a `@model` tag. Model properties are specified with `@property` tags. JSON Schema `additionalProperties` can be specified with `@additional_properties <type>` where `<type>` is any type defined elsewhere, or simply `false` to denote a closed model (`additionalProperties: false`).
@@ -49,6 +49,8 @@ module SwaggerYard
49
49
  end
50
50
 
51
51
  def add_yard_object(yard_object)
52
+ return self if yard_object.visibility == :private && !SwaggerYard.config.include_private
53
+
52
54
  case yard_object.type
53
55
  when :class # controller
54
56
  add_info(yard_object)
@@ -6,6 +6,7 @@ module SwaggerYard
6
6
  attr_accessor :controller_path, :model_path
7
7
  attr_accessor :path_discovery_function
8
8
  attr_accessor :security_definitions
9
+ attr_accessor :include_private
9
10
 
10
11
  # openapi-compatible names
11
12
  alias openapi_version swagger_version
@@ -20,6 +21,7 @@ module SwaggerYard
20
21
  @description = "Configure description with SwaggerYard.config.description"
21
22
  @security_definitions = {}
22
23
  @external_schema = {}
24
+ @include_private = true
23
25
  end
24
26
 
25
27
  def external_schema(mappings = nil)
@@ -1,3 +1,3 @@
1
1
  module SwaggerYard
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: swagger_yard
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
  - chtrinh (Chris Trinh)
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-10-27 00:00:00.000000000 Z
11
+ date: 2021-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: yard