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

[typespec-autorest]: suggest removing namespace from the definition name in swagger #2055

Open
4 tasks done
dolauli opened this issue Jan 8, 2025 · 2 comments
Open
4 tasks done
Labels
cli/psh Issues for Azure CLI/PSH features emitter:autorest Issues for @azure-tools/typespec-autorest emitter feature New feature or request triaged:core
Milestone

Comments

@dolauli
Copy link

dolauli commented Jan 8, 2025

Clear and concise description of the problem

The most common case occurs with Liftr-related services. The typespec-autorest tool prepends the namespace to model names when generating definition names in Swagger. For example:

"LiftrBase.MarketplaceDetails": {

However, for client emitters (such as C#, PowerShell, etc.), the namespace is ignored, for the example above, MarketplaceDetails will be used as the generated class name. This inconsistency will create significant challenges in the future when we transition from Swagger-based generation to typespec-based generation, as changes in definition (class) names will result in breaking changes.

I understand that the purpose of prepending the namespace is to avoid name conflicts. However, I propose the following approach:

Remove the namespace from the definition name and only prepend it when a name conflict is detected.

Checklist

  • Follow our Code of Conduct
  • Check that this issue is about the Azure libraries for typespec. For feature request in the typespec language or core libraries file it in the TypeSpec repo
  • Read the docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
@markcowl markcowl added feature New feature or request emitter:autorest Issues for @azure-tools/typespec-autorest emitter labels Jan 8, 2025
@markcowl markcowl added this to the Backlog milestone Jan 8, 2025
@allenjzhang
Copy link
Member

I assume this is an issue with swagger based CLI/PSH codegen with typespec-autorest emitted swagger, and NOT the typespec native CLI/PSH emitter, correct?

@markcowl markcowl added the cli/psh Issues for Azure CLI/PSH features label Jan 14, 2025
@dolauli
Copy link
Author

dolauli commented Jan 15, 2025

I assume this is an issue with swagger based CLI/PSH codegen with typespec-autorest emitted swagger, and NOT the typespec native CLI/PSH emitter, correct?

Yes. The inconsistency will cause breaking changes when we switch from swagger based codegen with autorest to typespec based codgen with emitter in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli/psh Issues for Azure CLI/PSH features emitter:autorest Issues for @azure-tools/typespec-autorest emitter feature New feature or request triaged:core
Projects
None yet
Development

No branches or pull requests

3 participants