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

[Bug]: typespec-autorest - path parameter should be excluded from the schema of request/response body #2040

Open
4 tasks done
dolauli opened this issue Jan 7, 2025 · 2 comments
Assignees
Labels
bug Something isn't working cli/psh Issues for Azure CLI/PSH features needs-area

Comments

@dolauli
Copy link

dolauli commented Jan 7, 2025

Describe the bug

For example, in tsp of AzureFleet.Management, we have name as path parameter. See here for details.

We should exclude the path parameter name from the schema definition virtualMachineScaleSet for request/response body.

Reproduction

An example has been provided above.

Checklist

  • Follow our Code of Conduct
  • Check that this issue is about the Azure libraries for typespec. For bug in the typespec language or core libraries file it in the TypeSpec repo
  • Check that there isn't already an issue that request the same bug to avoid creating a duplicate.
  • The provided reproduction is a minimal reproducible example of the bug.
@dolauli dolauli added the bug Something isn't working label Jan 7, 2025
@AllyW AllyW added the cli/psh Issues for Azure CLI/PSH features label Jan 7, 2025
@markcowl
Copy link
Member

markcowl commented Jan 7, 2025

@dolauli
Copy link
Author

dolauli commented Jan 8, 2025

Hi @markcowl, AzureFleet case is different.

For models that inherit from ProxyResource, such as model CertificateProfile is ProxyResource<CertificateProfileProperties> {, I believe you are correct, since the root model Resource has a property called name.

However, the VirtualMachineScaleSet model does not inherit from ProxyResource. It is defined as model VirtualMachineScaleSet {.

I also reviewed the implementations of the C# and TypeScript generators, and they both ignore path parameters in the schema of the request/response body.

By the way,

My understanding of the following code is that name is only a path parameter, not both a path parameter and a body parameter. Is that correct?

Model xxx {
  @doc("The name of the virtualMachineScaleSet")
  @key("virtualMachineScaleSetName")
  @segment("virtualMachineScaleSets")
  @visibility("read")
  @path
  name: string;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cli/psh Issues for Azure CLI/PSH features needs-area
Projects
None yet
Development

No branches or pull requests

3 participants