Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Mgmt][HLC] doesn't generate correct mapper for those renamed parameter because of reserved words. #1342

Closed
qiaozha opened this issue Mar 17, 2022 · 0 comments · Fixed by #2205
Assignees
Labels

Comments

@qiaozha
Copy link
Member

qiaozha commented Mar 17, 2022

For example the parameter we have for this checkNameAvailibitity is

  /**
   * Description for Check if a resource name is available.
   * @param name Resource name to verify.
   * @param typeParam Resource type used for verification.
   * @param options The options parameters.
   */
  checkNameAvailability(
    name: string,
    typeParam: CheckNameResourceTypes,
    options?: CheckNameAvailabilityOptionalParams
  ): Promise<CheckNameAvailabilityResponse> {
    return this.sendOperationRequest(
      { name, typeParam, options },
      checkNameAvailabilityOperationSpec
    );
  }

Here the typeParam is renamed from the reserved word type. but in the generated Mappers.

export const ResourceNameAvailabilityRequest: coreClient.CompositeMapper = {
  serializedName: "ResourceNameAvailabilityRequest",
  type: {
    name: "Composite",
    className: "ResourceNameAvailabilityRequest",
    modelProperties: {
      name: {
        serializedName: "name",
        required: true,
        xmlName: "name",
        type: {
          name: "String"
        }
      },
      type: {
        serializedName: "type",
        required: true,
        xmlName: "type",
        type: {
          name: "String"
        }
      },
      isFqdn: {
        serializedName: "isFqdn",
        xmlName: "isFqdn",
        type: {
          name: "Boolean"
        }
      }
    }
  }
};

we are still seeing type as the key, which cause the generated code can't work
image

This is original come from our customer reported Azure/azure-sdk-for-js#20728

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants