From b34a10aee7baaf30235958bdba825c4fa96addf4 Mon Sep 17 00:00:00 2001 From: jessemyers-lettuce <137568166+jessemyers-lettuce@users.noreply.github.com> Date: Tue, 5 Sep 2023 19:48:43 -0700 Subject: [PATCH] python: ignore long lines for model descriptions (#16518) Descriptions can easily exceed line-length limits because they are often extracted from doc/comments strings, which may use unexpected formatting. Python doc strings, in particular, are likely to use newlines, which mustache does not preserve, causing descriptions to be condensed to a single line. --- .../src/main/resources/python/model_generic.mustache | 4 ++-- .../echo_api/python/openapi_client/models/default_value.py | 2 +- .../python-aiohttp/petstore_api/models/class_model.py | 2 +- .../petstore/python-aiohttp/petstore_api/models/file.py | 2 +- .../python-aiohttp/petstore_api/models/health_check_result.py | 2 +- .../python-aiohttp/petstore_api/models/model200_response.py | 2 +- .../python-aiohttp/petstore_api/models/model_return.py | 2 +- .../petstore/python-aiohttp/petstore_api/models/name.py | 2 +- .../models/object_to_test_additional_properties.py | 2 +- .../client/petstore/python/petstore_api/models/class_model.py | 2 +- .../client/petstore/python/petstore_api/models/file.py | 2 +- .../python/petstore_api/models/health_check_result.py | 2 +- .../petstore/python/petstore_api/models/model200_response.py | 2 +- .../petstore/python/petstore_api/models/model_return.py | 2 +- .../client/petstore/python/petstore_api/models/name.py | 2 +- .../models/object_to_test_additional_properties.py | 2 +- 16 files changed, 17 insertions(+), 17 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/python/model_generic.mustache b/modules/openapi-generator/src/main/resources/python/model_generic.mustache index 1355ddbf20b..6a09b9c9bd1 100644 --- a/modules/openapi-generator/src/main/resources/python/model_generic.mustache +++ b/modules/openapi-generator/src/main/resources/python/model_generic.mustache @@ -12,7 +12,7 @@ import json class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}}): """ - {{{description}}}{{^description}}{{{classname}}}{{/description}} + {{#description}}{{{description}}} # noqa: E501{{/description}}{{^description}}{{{classname}}}{{/description}} """ {{#vars}} {{name}}: {{{vendorExtensions.x-py-typing}}} @@ -358,4 +358,4 @@ class {{classname}}({{#parent}}{{{.}}}{{/parent}}{{^parent}}BaseModel{{/parent}} {{{.}}} {{/vendorExtensions.x-py-postponed-model-imports}} {{classname}}.update_forward_refs() -{{/vendorExtensions.x-py-postponed-model-imports.size}} \ No newline at end of file +{{/vendorExtensions.x-py-postponed-model-imports.size}} diff --git a/samples/client/echo_api/python/openapi_client/models/default_value.py b/samples/client/echo_api/python/openapi_client/models/default_value.py index 568dcdf752f..a73193247fd 100644 --- a/samples/client/echo_api/python/openapi_client/models/default_value.py +++ b/samples/client/echo_api/python/openapi_client/models/default_value.py @@ -25,7 +25,7 @@ from openapi_client.models.string_enum_ref import StringEnumRef class DefaultValue(BaseModel): """ - to test the default value of properties + to test the default value of properties # noqa: E501 """ array_string_enum_ref_default: Optional[conlist(StringEnumRef)] = None array_string_enum_default: Optional[conlist(StrictStr)] = None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/class_model.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/class_model.py index 4a17279d002..d345924958e 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/class_model.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/class_model.py @@ -23,7 +23,7 @@ from pydantic import BaseModel, Field, StrictStr class ClassModel(BaseModel): """ - Model for testing model with \"_class\" property + Model for testing model with \"_class\" property # noqa: E501 """ var_class: Optional[StrictStr] = Field(None, alias="_class") __properties = ["_class"] diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/file.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/file.py index 70f34a147d4..c87e30f73bf 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/file.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/file.py @@ -23,7 +23,7 @@ from pydantic import BaseModel, Field, StrictStr class File(BaseModel): """ - Must be named `File` for test. + Must be named `File` for test. # noqa: E501 """ source_uri: Optional[StrictStr] = Field(None, alias="sourceURI", description="Test capitalization") __properties = ["sourceURI"] diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/health_check_result.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/health_check_result.py index 420f65a0a8c..02405bea384 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/health_check_result.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/health_check_result.py @@ -23,7 +23,7 @@ from pydantic import BaseModel, Field, StrictStr class HealthCheckResult(BaseModel): """ - Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. # noqa: E501 """ nullable_message: Optional[StrictStr] = Field(None, alias="NullableMessage") __properties = ["NullableMessage"] diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/model200_response.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/model200_response.py index 109d6855945..f129e4dafe8 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/model200_response.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/model200_response.py @@ -23,7 +23,7 @@ from pydantic import BaseModel, Field, StrictInt, StrictStr class Model200Response(BaseModel): """ - Model for testing model name starting with number + Model for testing model name starting with number # noqa: E501 """ name: Optional[StrictInt] = None var_class: Optional[StrictStr] = Field(None, alias="class") diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/model_return.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/model_return.py index f370adcc19e..1d2b0266d34 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/model_return.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/model_return.py @@ -23,7 +23,7 @@ from pydantic import BaseModel, Field, StrictInt class ModelReturn(BaseModel): """ - Model for testing reserved words + Model for testing reserved words # noqa: E501 """ var_return: Optional[StrictInt] = Field(None, alias="return") __properties = ["return"] diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/name.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/name.py index b6bf35f233a..5284db112e9 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/name.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/name.py @@ -23,7 +23,7 @@ from pydantic import BaseModel, Field, StrictInt, StrictStr class Name(BaseModel): """ - Model for testing model name same as property name + Model for testing model name same as property name # noqa: E501 """ name: StrictInt = Field(...) snake_case: Optional[StrictInt] = None diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/object_to_test_additional_properties.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/object_to_test_additional_properties.py index 1757c255c2f..f609e06f6a9 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/object_to_test_additional_properties.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/models/object_to_test_additional_properties.py @@ -23,7 +23,7 @@ from pydantic import BaseModel, Field, StrictBool class ObjectToTestAdditionalProperties(BaseModel): """ - Minimal object + Minimal object # noqa: E501 """ var_property: Optional[StrictBool] = Field(False, alias="property", description="Property") __properties = ["property"] diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/class_model.py b/samples/openapi3/client/petstore/python/petstore_api/models/class_model.py index a93f1f73826..f9464aa8562 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/class_model.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/class_model.py @@ -23,7 +23,7 @@ from pydantic import BaseModel, Field, StrictStr class ClassModel(BaseModel): """ - Model for testing model with \"_class\" property + Model for testing model with \"_class\" property # noqa: E501 """ var_class: Optional[StrictStr] = Field(None, alias="_class") additional_properties: Dict[str, Any] = {} diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/file.py b/samples/openapi3/client/petstore/python/petstore_api/models/file.py index 23636f580ea..f45b5114f2c 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/file.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/file.py @@ -23,7 +23,7 @@ from pydantic import BaseModel, Field, StrictStr class File(BaseModel): """ - Must be named `File` for test. + Must be named `File` for test. # noqa: E501 """ source_uri: Optional[StrictStr] = Field(None, alias="sourceURI", description="Test capitalization") additional_properties: Dict[str, Any] = {} diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/health_check_result.py b/samples/openapi3/client/petstore/python/petstore_api/models/health_check_result.py index 5e4907ea399..ec2c401c363 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/health_check_result.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/health_check_result.py @@ -23,7 +23,7 @@ from pydantic import BaseModel, Field, StrictStr class HealthCheckResult(BaseModel): """ - Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. + Just a string to inform instance is up and running. Make it nullable in hope to get it as pointer in generated model. # noqa: E501 """ nullable_message: Optional[StrictStr] = Field(None, alias="NullableMessage") additional_properties: Dict[str, Any] = {} diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/model200_response.py b/samples/openapi3/client/petstore/python/petstore_api/models/model200_response.py index 689cbe20ff7..63c69743338 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/model200_response.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/model200_response.py @@ -23,7 +23,7 @@ from pydantic import BaseModel, Field, StrictInt, StrictStr class Model200Response(BaseModel): """ - Model for testing model name starting with number + Model for testing model name starting with number # noqa: E501 """ name: Optional[StrictInt] = None var_class: Optional[StrictStr] = Field(None, alias="class") diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/model_return.py b/samples/openapi3/client/petstore/python/petstore_api/models/model_return.py index c825c9c206f..a7212e506b6 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/model_return.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/model_return.py @@ -23,7 +23,7 @@ from pydantic import BaseModel, Field, StrictInt class ModelReturn(BaseModel): """ - Model for testing reserved words + Model for testing reserved words # noqa: E501 """ var_return: Optional[StrictInt] = Field(None, alias="return") additional_properties: Dict[str, Any] = {} diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/name.py b/samples/openapi3/client/petstore/python/petstore_api/models/name.py index 81553c5d5da..180e06e24c5 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/name.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/name.py @@ -23,7 +23,7 @@ from pydantic import BaseModel, Field, StrictInt, StrictStr class Name(BaseModel): """ - Model for testing model name same as property name + Model for testing model name same as property name # noqa: E501 """ name: StrictInt = Field(...) snake_case: Optional[StrictInt] = None diff --git a/samples/openapi3/client/petstore/python/petstore_api/models/object_to_test_additional_properties.py b/samples/openapi3/client/petstore/python/petstore_api/models/object_to_test_additional_properties.py index fe2d99527fa..21e9a30d7df 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/models/object_to_test_additional_properties.py +++ b/samples/openapi3/client/petstore/python/petstore_api/models/object_to_test_additional_properties.py @@ -23,7 +23,7 @@ from pydantic import BaseModel, Field, StrictBool class ObjectToTestAdditionalProperties(BaseModel): """ - Minimal object + Minimal object # noqa: E501 """ var_property: Optional[StrictBool] = Field(False, alias="property", description="Property") additional_properties: Dict[str, Any] = {}