Skip to content

[Python] Autorest generates a method signature with twice the same parameter #1738

Closed

Description

This creates invalid code:

    def resend_request_emails(
            self, resource_group_name, name, name=None, custom_headers=None, raw=False, **operation_config):
        """Verify domain ownership for this certificate order.
        Verify domain ownership for this certificate order.
        :param resource_group_name: Name of the resource group to which the
         resource belongs.
        :type resource_group_name: str
        :param name: Certificate order name
        :type name: str
        :param name: Name of the object.
        :type name: str

Based on the docstring, it seems there is two differents objects that wants the same parameter name, but obviously it not possible.

Generated with latest Autorest (20170114) and WebApp composite client. Method is here:

       "parameters": [
          {
            "$ref": "#/parameters/resourceGroupNameParameter"
          },
          {
            "name": "name",
            "in": "path",
            "description": "Certificate order name",
            "required": true,
            "type": "string"
          },
          {
            "name": "nameIdentifier",
            "in": "body",
            "description": "Email address",
            "required": true,
            "schema": {
              "$ref": "#/definitions/NameIdentifier"
            }
          },
...
    "NameIdentifier": {
      "description": "Identifies an object.",
      "type": "object",
      "properties": {
        "name": {
          "description": "Name of the object.",
          "type": "string"
        }
      }
    },

Python code is here.

Autorest cmd line:
mono /tmp/tmpwl8glpmr/autorest/tools/AutoRest.exe -i /git-restapi/arm-web/compositeWebAppClient.json -o /tmp/tmpwl8glpmr/compositeWebAppClient.json -AddCredentials True -CodeGenerator Azure.Python -Header MICROSOFT_MIT_NO_VERSION -Modeler CompositeSwagger -Namespace azure.mgmt.web -PackageVersion 0.31.0 -ft 2

FYI @annatisch @fearthecowboy @yugangw-msft

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions