Skip to content

Commit

Permalink
Add skip enum value generation (#3767)
Browse files Browse the repository at this point in the history
* Add skip enum value generation

* Fix default

* Fix reader

* Fix line spacing on enum values
  • Loading branch information
slevenick authored Jul 23, 2020
1 parent 8576220 commit 0b85c06
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 42 deletions.
2 changes: 2 additions & 0 deletions api/type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -456,10 +456,12 @@ def item_type_class
# Represents an enum, and store is valid values
class Enum < Primitive
attr_reader :values
attr_reader :skip_docs_values

def validate
super
check :values, type: ::Array, item_type: [Symbol, ::String, ::Integer], required: true
check :skip_docs_values, type: :boolean
end
end

Expand Down
130 changes: 89 additions & 41 deletions products/compute/api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9819,13 +9819,19 @@ objects:
name: 'redirectResponseCode'
description: |
The HTTP Status code to use for this RedirectAction. Supported values are:
- MOVED_PERMANENTLY_DEFAULT, which is the default value and corresponds to 301.
- FOUND, which corresponds to 302.
- SEE_OTHER which corresponds to 303.
- TEMPORARY_REDIRECT, which corresponds to 307. In this case, the request method

* MOVED_PERMANENTLY_DEFAULT, which is the default value and corresponds to 301.

* FOUND, which corresponds to 302.

* SEE_OTHER which corresponds to 303.

* TEMPORARY_REDIRECT, which corresponds to 307. In this case, the request method
will be retained.
- PERMANENT_REDIRECT, which corresponds to 308. In this case,

* PERMANENT_REDIRECT, which corresponds to 308. In this case,
the request method will be retained.
skip_docs_values: true
values:
- :FOUND
- :MOVED_PERMANENTLY_DEFAULT
Expand Down Expand Up @@ -10238,13 +10244,19 @@ objects:
name: 'redirectResponseCode'
description: |
The HTTP Status code to use for this RedirectAction. Supported values are:
- MOVED_PERMANENTLY_DEFAULT, which is the default value and corresponds to 301.
- FOUND, which corresponds to 302.
- SEE_OTHER which corresponds to 303.
- TEMPORARY_REDIRECT, which corresponds to 307. In this case, the request method

* MOVED_PERMANENTLY_DEFAULT, which is the default value and corresponds to 301.

* FOUND, which corresponds to 302.

* SEE_OTHER which corresponds to 303.

* TEMPORARY_REDIRECT, which corresponds to 307. In this case, the request method
will be retained.
- PERMANENT_REDIRECT, which corresponds to 308. In this case,

* PERMANENT_REDIRECT, which corresponds to 308. In this case,
the request method will be retained.
skip_docs_values: true
values:
- :FOUND
- :MOVED_PERMANENTLY_DEFAULT
Expand Down Expand Up @@ -10301,13 +10313,19 @@ objects:
name: 'redirectResponseCode'
description: |
The HTTP Status code to use for this RedirectAction. Supported values are:
- MOVED_PERMANENTLY_DEFAULT, which is the default value and corresponds to 301.
- FOUND, which corresponds to 302.
- SEE_OTHER which corresponds to 303.
- TEMPORARY_REDIRECT, which corresponds to 307. In this case, the request method

* MOVED_PERMANENTLY_DEFAULT, which is the default value and corresponds to 301.

* FOUND, which corresponds to 302.

* SEE_OTHER which corresponds to 303.

* TEMPORARY_REDIRECT, which corresponds to 307. In this case, the request method
will be retained.
- PERMANENT_REDIRECT, which corresponds to 308. In this case,

* PERMANENT_REDIRECT, which corresponds to 308. In this case,
the request method will be retained.
skip_docs_values: true
values:
- :FOUND
- :MOVED_PERMANENTLY_DEFAULT
Expand Down Expand Up @@ -10390,13 +10408,19 @@ objects:
name: 'redirectResponseCode'
description: |
The HTTP Status code to use for this RedirectAction. Supported values are:
- MOVED_PERMANENTLY_DEFAULT, which is the default value and corresponds to 301.
- FOUND, which corresponds to 302.
- SEE_OTHER which corresponds to 303.
- TEMPORARY_REDIRECT, which corresponds to 307. In this case, the request method

* MOVED_PERMANENTLY_DEFAULT, which is the default value and corresponds to 301.

* FOUND, which corresponds to 302.

* SEE_OTHER which corresponds to 303.

* TEMPORARY_REDIRECT, which corresponds to 307. In this case, the request method
will be retained.
- PERMANENT_REDIRECT, which corresponds to 308. In this case,

* PERMANENT_REDIRECT, which corresponds to 308. In this case,
the request method will be retained.
skip_docs_values: true
values:
- :FOUND
- :MOVED_PERMANENTLY_DEFAULT
Expand Down Expand Up @@ -14803,13 +14827,19 @@ objects:
name: 'redirectResponseCode'
description: |
The HTTP Status code to use for this RedirectAction. Supported values are:
- MOVED_PERMANENTLY_DEFAULT, which is the default value and corresponds to 301.
- FOUND, which corresponds to 302.
- SEE_OTHER which corresponds to 303.
- TEMPORARY_REDIRECT, which corresponds to 307. In this case, the request method

* MOVED_PERMANENTLY_DEFAULT, which is the default value and corresponds to 301.

* FOUND, which corresponds to 302.

* SEE_OTHER which corresponds to 303.

* TEMPORARY_REDIRECT, which corresponds to 307. In this case, the request method
will be retained.
- PERMANENT_REDIRECT, which corresponds to 308. In this case,

* PERMANENT_REDIRECT, which corresponds to 308. In this case,
the request method will be retained.
skip_docs_values: true
values:
- :FOUND
- :MOVED_PERMANENTLY_DEFAULT
Expand Down Expand Up @@ -15482,12 +15512,18 @@ objects:
- !ruby/object:Api::Type::Enum
name: 'redirectResponseCode'
description: |
The HTTP Status code to use for this RedirectAction. Supported values are: -
MOVED_PERMANENTLY_DEFAULT, which is the default value and corresponds to 301. -
FOUND, which corresponds to 302. - SEE_OTHER which corresponds to 303. -
TEMPORARY_REDIRECT, which corresponds to 307. In this case, the request method
will be retained. - PERMANENT_REDIRECT, which corresponds to 308. In this case,
the request method will be retained.
The HTTP Status code to use for this RedirectAction. Supported values are:

* MOVED_PERMANENTLY_DEFAULT, which is the default value and corresponds to 301.

* FOUND, which corresponds to 302.

* SEE_OTHER which corresponds to 303.

* TEMPORARY_REDIRECT, which corresponds to 307. In this case, the request method will be retained.

* PERMANENT_REDIRECT, which corresponds to 308. In this case, the request method will be retained.
skip_docs_values: true
values:
- :FOUND
- :MOVED_PERMANENTLY_DEFAULT
Expand Down Expand Up @@ -15547,13 +15583,19 @@ objects:
name: 'redirectResponseCode'
description: |
The HTTP Status code to use for this RedirectAction. Supported values are:
- MOVED_PERMANENTLY_DEFAULT, which is the default value and corresponds to 301.
- FOUND, which corresponds to 302.
- SEE_OTHER which corresponds to 303.
- TEMPORARY_REDIRECT, which corresponds to 307. In this case, the request method

* MOVED_PERMANENTLY_DEFAULT, which is the default value and corresponds to 301.

* FOUND, which corresponds to 302.

* SEE_OTHER which corresponds to 303.

* TEMPORARY_REDIRECT, which corresponds to 307. In this case, the request method
will be retained.
- PERMANENT_REDIRECT, which corresponds to 308. In this case,

* PERMANENT_REDIRECT, which corresponds to 308. In this case,
the request method will be retained.
skip_docs_values: true
values:
- :FOUND
- :MOVED_PERMANENTLY_DEFAULT
Expand Down Expand Up @@ -15952,13 +15994,19 @@ objects:
name: 'redirectResponseCode'
description: |
The HTTP Status code to use for this RedirectAction. Supported values are:
- MOVED_PERMANENTLY_DEFAULT, which is the default value and corresponds to 301.
- FOUND, which corresponds to 302.
- SEE_OTHER which corresponds to 303.
- TEMPORARY_REDIRECT, which corresponds to 307. In this case, the request method

* MOVED_PERMANENTLY_DEFAULT, which is the default value and corresponds to 301.

* FOUND, which corresponds to 302.

* SEE_OTHER which corresponds to 303.

* TEMPORARY_REDIRECT, which corresponds to 307. In this case, the request method
will be retained.
- PERMANENT_REDIRECT, which corresponds to 308. In this case,

* PERMANENT_REDIRECT, which corresponds to 308. In this case,
the request method will be retained.
skip_docs_values: true
values:
- :FOUND
- :MOVED_PERMANENTLY_DEFAULT
Expand Down
3 changes: 2 additions & 1 deletion templates/terraform/property_documentation.erb
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@
<% end -%>
<% end -%>
<%= indent(property.description.strip.gsub("\n\n", "\n"), 2) -%>
<% if property.is_a?(Api::Type::Enum) && !property.output -%>
<% if property.is_a?(Api::Type::Enum) && !property.output && !property.skip_docs_values -%>


<% unless property.default_value.nil? || property.default_value == "" -%>
Default value: `<%= property.default_value %>`

<% end -%>
Possible values are:
<% property.values.select { |v| v != "" }.each do |v| -%>
Expand Down

0 comments on commit 0b85c06

Please sign in to comment.