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

[tcgc] Support @typespec/openapi3 in scope #1738

Closed
4 tasks done
wanlwanl opened this issue Oct 24, 2024 · 4 comments
Closed
4 tasks done

[tcgc] Support @typespec/openapi3 in scope #1738

wanlwanl opened this issue Oct 24, 2024 · 4 comments
Labels
lib:tcgc Issues for @azure-tools/typespec-client-generator-core library

Comments

@wanlwanl
Copy link
Member

Clear and concise description of the problem

openapi3 and TCGC are used together for service team now. e.g. https://github.com/Azure/azure-rest-api-specs/blob/main/specification/ai/OpenAI.Assistants/tspconfig.yaml#L10

But the current implemetation doesn't support @typespec/openapi3 due to:

const regex = /(?:cadl|typespec|client|server)-([^\\/-]*)/;

Please support @typespec/openapi3 in scope

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.
@wanlwanl wanlwanl added the lib:tcgc Issues for @azure-tools/typespec-client-generator-core library label Oct 24, 2024
@timotheeguerin
Copy link
Member

timotheeguerin commented Oct 25, 2024

there is 2 things here:

  1. openapi3 shouldn't use tcgc anyway, what are you trying to do?
  2. the scope here should always allow the emitter full name

@wanlwanl
Copy link
Member Author

@timotheeguerin

  1. I'm trying set @clentname with scope. java emitter and autorest emitter has different behaviors as you share screen before. When openAPI's version increases inthe future, I feel like we might need to customize some where. e.g. OpenAI.Assistants used tcgc and emit OAS3. https://github.com/Azure/azure-rest-api-specs/blob/main/specification/ai/OpenAI.Assistants/client.tsp .
  2. No, I tried: [DO NOT REVIEW] Test scope #1751
    I got
AssertionError: Expected values to be strictly equal:
+ actual - expected

+ 'Test'
- 'TestOAS3'
       ^

Expected: "TestOAS3"
Received: "Test"

@timotheeguerin
Copy link
Member

For 2. I mean this should be how it works, and it was supposed to work that way with tcgc so they definitely have a bug if it doesn't.

For 1. there is 2 reason why it doesn't make sense to support in openapi3:

  1. this is an azure library, none of the @typespec/ packages should be using them
  2. OpenAPI doesn't describe client, it describe the service contract. There is nowhere to put a client name in the spec apart from using x- extensions and we explicitly don't want the openapi3 emitter to have any of those. Autorest swagger emits it because it target the augmented version of swagger 2.0 meant for autorest.

@wanlwanl
Copy link
Member Author

Thanks for the explain. I thought we need to keep the same behavior to autorest swagger.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lib:tcgc Issues for @azure-tools/typespec-client-generator-core library
Projects
None yet
Development

No branches or pull requests

2 participants