Skip to content

Commit 8783ad8

Browse files
authored
[Python] List enum members in docs (#18804)
* List enum values in docs * Remove newline * Remove another newline * Generate samples
1 parent e2258fb commit 8783ad8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+314
-120
lines changed

modules/openapi-generator/src/main/resources/python-fastapi/model_doc.mustache

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
{{#description}}{{&description}}
44
{{/description}}
55

6+
{{^isEnum}}
67
## Properties
78

89
Name | Type | Description | Notes
910
------------ | ------------- | ------------- | -------------
1011
{{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#isReadOnly}}[readonly] {{/isReadOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}}
1112
{{/vars}}
1213

13-
{{^isEnum}}
1414
## Example
1515

1616
```python
@@ -29,6 +29,12 @@ print {{classname}}.to_json()
2929
{{#lambda.snakecase}}{{classname}}{{/lambda.snakecase}}_from_dict = {{classname}}.from_dict({{#lambda.snakecase}}{{classname}}{{/lambda.snakecase}}_dict)
3030
```
3131
{{/isEnum}}
32+
{{#isEnum}}
33+
## Enum
34+
{{#allowableValues}}{{#enumVars}}
35+
* `{{name}}` (value: `{{{value}}}`)
36+
{{/enumVars}}{{/allowableValues}}
37+
{{/isEnum}}
3238
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
3339

3440
{{/model}}{{/models}}

modules/openapi-generator/src/main/resources/python-pydantic-v1/model_doc.mustache

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
{{#description}}{{&description}}
44
{{/description}}
55

6+
{{^isEnum}}
67
## Properties
78
Name | Type | Description | Notes
89
------------ | ------------- | ------------- | -------------
910
{{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#isReadOnly}}[readonly] {{/isReadOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}}
1011
{{/vars}}
1112

12-
{{^isEnum}}
1313
## Example
1414

1515
```python
@@ -28,6 +28,12 @@ print {{classname}}.to_json()
2828
{{#lambda.snakecase}}{{classname}}{{/lambda.snakecase}}_from_dict = {{classname}}.from_dict({{#lambda.snakecase}}{{classname}}{{/lambda.snakecase}}_dict)
2929
```
3030
{{/isEnum}}
31+
{{#isEnum}}
32+
## Enum
33+
{{#allowableValues}}{{#enumVars}}
34+
* `{{name}}` (value: `{{{value}}}`)
35+
{{/enumVars}}{{/allowableValues}}
36+
{{/isEnum}}
3137
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
3238

3339
{{/model}}{{/models}}

modules/openapi-generator/src/main/resources/python/model_doc.mustache

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
{{#description}}{{&description}}
44
{{/description}}
55

6+
{{^isEnum}}
67
## Properties
78

89
Name | Type | Description | Notes
910
------------ | ------------- | ------------- | -------------
1011
{{#vars}}**{{name}}** | {{#isPrimitiveType}}**{{dataType}}**{{/isPrimitiveType}}{{^isPrimitiveType}}[**{{dataType}}**]({{complexType}}.md){{/isPrimitiveType}} | {{description}} | {{^required}}[optional] {{/required}}{{#isReadOnly}}[readonly] {{/isReadOnly}}{{#defaultValue}}[default to {{{.}}}]{{/defaultValue}}
1112
{{/vars}}
1213

13-
{{^isEnum}}
1414
## Example
1515

1616
```python
@@ -29,6 +29,12 @@ print({{classname}}.to_json())
2929
{{#lambda.snakecase}}{{classname}}{{/lambda.snakecase}}_from_dict = {{classname}}.from_dict({{#lambda.snakecase}}{{classname}}{{/lambda.snakecase}}_dict)
3030
```
3131
{{/isEnum}}
32+
{{#isEnum}}
33+
## Enum
34+
{{#allowableValues}}{{#enumVars}}
35+
* `{{name}}` (value: `{{{value}}}`)
36+
{{/enumVars}}{{/allowableValues}}
37+
{{/isEnum}}
3238
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
3339

3440
{{/model}}{{/models}}

samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent/docs/StringEnumRef.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
# StringEnumRef
22

33

4-
## Properties
4+
## Enum
55

6-
Name | Type | Description | Notes
7-
------------ | ------------- | ------------- | -------------
6+
* `SUCCESS` (value: `'success'`)
7+
8+
* `FAILURE` (value: `'failure'`)
9+
10+
* `UNCLASSIFIED` (value: `'unclassified'`)
811

912
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
1013

samples/client/echo_api/python-pydantic-v1/docs/StringEnumRef.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
# StringEnumRef
22

33

4-
## Properties
5-
Name | Type | Description | Notes
6-
------------ | ------------- | ------------- | -------------
4+
## Enum
5+
6+
* `SUCCESS` (value: `'success'`)
7+
8+
* `FAILURE` (value: `'failure'`)
9+
10+
* `UNCLASSIFIED` (value: `'unclassified'`)
711

812
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
913

samples/client/echo_api/python/docs/StringEnumRef.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
# StringEnumRef
22

33

4-
## Properties
4+
## Enum
55

6-
Name | Type | Description | Notes
7-
------------ | ------------- | ------------- | -------------
6+
* `SUCCESS` (value: `'success'`)
7+
8+
* `FAILURE` (value: `'failure'`)
9+
10+
* `UNCLASSIFIED` (value: `'unclassified'`)
811

912
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
1013

samples/openapi3/client/petstore/python-aiohttp/docs/EnumClass.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
# EnumClass
22

33

4-
## Properties
4+
## Enum
55

6-
Name | Type | Description | Notes
7-
------------ | ------------- | ------------- | -------------
6+
* `ABC` (value: `'_abc'`)
7+
8+
* `MINUS_EFG` (value: `'-efg'`)
9+
10+
* `LEFT_PARENTHESIS_XYZ_RIGHT_PARENTHESIS` (value: `'(xyz)'`)
811

912
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
1013

samples/openapi3/client/petstore/python-aiohttp/docs/EnumString1.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# EnumString1
22

33

4-
## Properties
4+
## Enum
55

6-
Name | Type | Description | Notes
7-
------------ | ------------- | ------------- | -------------
6+
* `A` (value: `'a'`)
7+
8+
* `B` (value: `'b'`)
89

910
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
1011

samples/openapi3/client/petstore/python-aiohttp/docs/EnumString2.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# EnumString2
22

33

4-
## Properties
4+
## Enum
55

6-
Name | Type | Description | Notes
7-
------------ | ------------- | ------------- | -------------
6+
* `C` (value: `'c'`)
7+
8+
* `D` (value: `'d'`)
89

910
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
1011

samples/openapi3/client/petstore/python-aiohttp/docs/OuterEnum.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
# OuterEnum
22

33

4-
## Properties
4+
## Enum
55

6-
Name | Type | Description | Notes
7-
------------ | ------------- | ------------- | -------------
6+
* `PLACED` (value: `'placed'`)
7+
8+
* `APPROVED` (value: `'approved'`)
9+
10+
* `DELIVERED` (value: `'delivered'`)
811

912
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
1013

samples/openapi3/client/petstore/python-aiohttp/docs/OuterEnumDefaultValue.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
# OuterEnumDefaultValue
22

33

4-
## Properties
4+
## Enum
55

6-
Name | Type | Description | Notes
7-
------------ | ------------- | ------------- | -------------
6+
* `PLACED` (value: `'placed'`)
7+
8+
* `APPROVED` (value: `'approved'`)
9+
10+
* `DELIVERED` (value: `'delivered'`)
811

912
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
1013

samples/openapi3/client/petstore/python-aiohttp/docs/OuterEnumInteger.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
# OuterEnumInteger
22

33

4-
## Properties
4+
## Enum
55

6-
Name | Type | Description | Notes
7-
------------ | ------------- | ------------- | -------------
6+
* `NUMBER_0` (value: `0`)
7+
8+
* `NUMBER_1` (value: `1`)
9+
10+
* `NUMBER_2` (value: `2`)
811

912
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
1013

samples/openapi3/client/petstore/python-aiohttp/docs/OuterEnumIntegerDefaultValue.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
# OuterEnumIntegerDefaultValue
22

33

4-
## Properties
4+
## Enum
55

6-
Name | Type | Description | Notes
7-
------------ | ------------- | ------------- | -------------
6+
* `NUMBER_MINUS_1` (value: `-1`)
7+
8+
* `NUMBER_0` (value: `0`)
9+
10+
* `NUMBER_1` (value: `1`)
11+
12+
* `NUMBER_2` (value: `2`)
813

914
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
1015

samples/openapi3/client/petstore/python-aiohttp/docs/SingleRefType.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# SingleRefType
22

33

4-
## Properties
4+
## Enum
55

6-
Name | Type | Description | Notes
7-
------------ | ------------- | ------------- | -------------
6+
* `ADMIN` (value: `'admin'`)
7+
8+
* `USER` (value: `'user'`)
89

910
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
1011

samples/openapi3/client/petstore/python-aiohttp/docs/SpecialCharacterEnum.md

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,27 @@
11
# SpecialCharacterEnum
22

33

4-
## Properties
4+
## Enum
55

6-
Name | Type | Description | Notes
7-
------------ | ------------- | ------------- | -------------
6+
* `ENUM_456` (value: `'456'`)
7+
8+
* `ENUM_123ABC` (value: `'123abc'`)
9+
10+
* `UNDERSCORE` (value: `'_'`)
11+
12+
* `SPACE` (value: `' '`)
13+
14+
* `AMPERSAND` (value: `'&'`)
15+
16+
* `DOLLAR` (value: `'$'`)
17+
18+
* `GREATER_THAN_EQUAL` (value: `'>='`)
19+
20+
* `THIS_IS_EXCLAMATION` (value: `'this_is_!'`)
21+
22+
* `IMPORT` (value: `'import'`)
23+
24+
* `HELLO_WORLD` (value: `' hello world '`)
825

926
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
1027

samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumClass.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
# EnumClass
22

33

4-
## Properties
5-
Name | Type | Description | Notes
6-
------------ | ------------- | ------------- | -------------
4+
## Enum
5+
6+
* `ABC` (value: `'_abc'`)
7+
8+
* `MINUS_EFG` (value: `'-efg'`)
9+
10+
* `LEFT_PARENTHESIS_XYZ_RIGHT_PARENTHESIS` (value: `'(xyz)'`)
711

812
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
913

samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumString1.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# EnumString1
22

33

4-
## Properties
5-
Name | Type | Description | Notes
6-
------------ | ------------- | ------------- | -------------
4+
## Enum
5+
6+
* `A` (value: `'a'`)
7+
8+
* `B` (value: `'b'`)
79

810
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
911

samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/EnumString2.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# EnumString2
22

33

4-
## Properties
5-
Name | Type | Description | Notes
6-
------------ | ------------- | ------------- | -------------
4+
## Enum
5+
6+
* `C` (value: `'c'`)
7+
8+
* `D` (value: `'d'`)
79

810
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
911

samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterEnum.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
# OuterEnum
22

33

4-
## Properties
5-
Name | Type | Description | Notes
6-
------------ | ------------- | ------------- | -------------
4+
## Enum
5+
6+
* `PLACED` (value: `'placed'`)
7+
8+
* `APPROVED` (value: `'approved'`)
9+
10+
* `DELIVERED` (value: `'delivered'`)
711

812
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
913

samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterEnumDefaultValue.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
# OuterEnumDefaultValue
22

33

4-
## Properties
5-
Name | Type | Description | Notes
6-
------------ | ------------- | ------------- | -------------
4+
## Enum
5+
6+
* `PLACED` (value: `'placed'`)
7+
8+
* `APPROVED` (value: `'approved'`)
9+
10+
* `DELIVERED` (value: `'delivered'`)
711

812
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
913

samples/openapi3/client/petstore/python-pydantic-v1-aiohttp/docs/OuterEnumInteger.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
# OuterEnumInteger
22

33

4-
## Properties
5-
Name | Type | Description | Notes
6-
------------ | ------------- | ------------- | -------------
4+
## Enum
5+
6+
* `NUMBER_0` (value: `0`)
7+
8+
* `NUMBER_1` (value: `1`)
9+
10+
* `NUMBER_2` (value: `2`)
711

812
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
913

0 commit comments

Comments
 (0)