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

[tsp-client convert] Error "invalid-ref: Unknown identifier AadOauth2Auth" converting contosowidgetmanager/data-plane #5055

Open
mikeharder opened this issue Jan 16, 2025 · 3 comments
Assignees

Comments

@mikeharder
Copy link
Member

mikeharder commented Jan 16, 2025

Using @azure-tools/[email protected] and @autorest/[email protected], converting contosowidgetmanager/data-plane fails with an error compiling the generated code:

$ mkdir specification/contosowidgetmanager/Test.TspClientConvert
$ npx tsp-client convert --no-prompt --swagger-readme specification/contosowidgetmanager/data-plane/readme.md -o specification/contosowidgetmanager/Test.TspClientConvert

$ npx tsp compile specification/contosowidgetmanager/Test.TspClientConvert
specification/contosowidgetmanager/Test.TspClientConvert/main.tsp:20:10 - error invalid-ref: Unknown identifier AadOauth2Auth
> 20 | @useAuth(AadOauth2Auth<["https://contoso.azure.com/.default"]>)
     |          ^^^^^^^^^^^^^

data-plane test in azure-rest-api-specs is currently disabled due to this issue:

https://github.com/Azure/azure-rest-api-specs/blob/main/eng/tools/tsp-client-tests/test/tsp-client.test.ts#L75

@pshao25
Copy link
Member

pshao25 commented Jan 17, 2025

@mikeharder I think we have some miscommunication here. @ArthurMa1978 yesterday replied in the email that we think

Running conversion tests on the spec repo is not ideal, as it is a post-check that cannot catch issues immediately. Additionally, conversion is not a common action for TSP upgrades.

Can we understand the reason why we add this test in specs repo but not converter repo?

@mikeharder
Copy link
Member Author

mikeharder commented Jan 17, 2025

For now, I'll standardize on using Contoso in the specs repo as an acceptance test.

I think you adding the same test to the converter repo is a great idea.

Once the test is working in your repo, you can close this issue which will notify me to re-enable the test in the specs repo.

@pshao25
Copy link
Member

pshao25 commented Jan 20, 2025

@mikeharder The swagger is not a good one. Look at this operation. Manually, I think it should be deleteWidget is Azure.Core.LongRunningResourceDelete<WidgetSuite>; But in this whole operation, there is no place you could find a thing called WidgetSuite. Then how could converter know the response is WidgetSuite?

I saw your swagger is a generated one from TypeSpec. I think this is a roundtrip case need to discussion with TypeSpec team.

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

No branches or pull requests

2 participants