github.com/phrase/openapi@v0.0.0-20240514140800-49e8a106740e/openapi-generator/templates/python/python-experimental/model_templates/model_composed.mustache (about)

     1  class {{unescapedDescription}}(ModelComposed):
     2      """NOTE: This class is auto generated by OpenAPI Generator.
     3      Ref: https://openapi-generator.tech
     4  
     5      Do not edit the class manually.
     6  
     7      Attributes:
     8  {{> python-experimental/model_templates/docstring_allowed }}
     9        attribute_map (dict): The key is attribute name
    10            and the value is json key in definition.
    11        discriminator_value_class_map (dict): A dict to go from the discriminator
    12            variable value to the discriminator class name.
    13  {{> python-experimental/model_templates/docstring_openapi_validations }}
    14      """
    15  
    16  {{> python-experimental/model_templates/classvars }}
    17  
    18      attribute_map = {
    19  {{#requiredVars}}
    20          '{{name}}': '{{baseName}}',  # noqa: E501
    21  {{/requiredVars}}
    22  {{#optionalVars}}
    23          '{{name}}': '{{baseName}}',  # noqa: E501
    24  {{/optionalVars}}
    25      }
    26  
    27  {{> python-experimental/model_templates/method_init_composed }}
    28  
    29      @staticmethod
    30      def _composed_schemas():
    31          # we need this here to make our import statements work
    32          # we must store _composed_schemas in here so the code is only run
    33          # when we invoke this method. If we kept this at the class
    34          # level we would get an error beause the class level
    35          # code would be run when this module is imported, and these composed
    36          # classes don't exist yet because their module has not finished
    37          # loading
    38          return {
    39            'anyOf': [
    40  {{#anyOf}}
    41                {{{.}}},
    42  {{/anyOf}}
    43            ],
    44            'allOf': [
    45  {{#allOf}}
    46                {{{.}}},
    47  {{/allOf}}
    48            ],
    49            'oneOf': [
    50  {{#oneOf}}
    51                {{{.}}},
    52  {{/oneOf}}
    53            ],
    54          }{{#discriminator}}
    55  
    56  {{> python-experimental/model_templates/method_discriminator }}{{/discriminator}}