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]: tcgc, missing json for model within multipart #2118

Closed
4 tasks done
weidongxu-microsoft opened this issue Jan 22, 2025 · 6 comments · Fixed by #2159
Closed
4 tasks done

[Bug]: tcgc, missing json for model within multipart #2118

weidongxu-microsoft opened this issue Jan 22, 2025 · 6 comments · Fixed by #2159
Assignees
Labels
bug Something isn't working lib:tcgc Issues for @azure-tools/typespec-client-generator-core library

Comments

@weidongxu-microsoft
Copy link
Member

Describe the bug

tcgc 0.50.2

https://github.com/microsoft/typespec/blob/main/packages/http-specs/specs/payload/multipart/main.tsp#L16-L18

Image

It should be a "json" model.

Reproduction

https://github.com/microsoft/typespec/blob/main/packages/http-specs/specs/payload/multipart/main.tsp#L16-L18

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.
@weidongxu-microsoft weidongxu-microsoft added bug Something isn't working lib:tcgc Issues for @azure-tools/typespec-client-generator-core library labels Jan 22, 2025
@tadelesh
Copy link
Member

@iscai-msft could you help to fix it since i'll oof next week?

github-merge-queue bot pushed a commit to microsoft/typespec that referenced this issue Jan 24, 2025
link #5511

1. bump tcgc to 0.50.2
2. adopt part of the `serializationOptions` (not a full adoption due to
bug Azure/typespec-azure#2118)
3. refactor entry, now it is `index.ts`, which exposes the few types
needed by compiler
4. migrate to the standard diagnostic in typespec compiler
5. some refactor on error/warning code and message, group some to same
code, etc.
6. add `target` to diagnostic, when we can find it
@iscai-msft
Copy link
Contributor

confirmed with @timotheeguerin offline that we can only get the json serialization information if we define with HttpPart instead of with the old way of doing multipart. I have a PR for this that gets the information during HttpPart definitions, but it doesn't fix the exact test that @weidongxu-microsoft is pointing to.

Do we feel it's worth it to keep tests using the old multipart definition way?

github-merge-queue bot pushed a commit that referenced this issue Jan 31, 2025
fixes #2118

---------

Co-authored-by: iscai-msft <[email protected]>
@weidongxu-microsoft
Copy link
Member Author

weidongxu-microsoft commented Feb 5, 2025

@iscai-msft

We currently have existing service use this (pre-HttpPart) pattern
https://github.com/Azure/azure-rest-api-specs/blob/main/specification/ai/Face/models.session.tsp#L312-L321
CreateLivenessWithVerifySessionJsonContent is a JSON object.

If we discard old pattern, we need to update their TypeSpec source.

PS: I am not sure the current status of the support for HttpPart in all emitters. Pre-Jan I know .NET does not support. Not sure how it progressed after unbranded efforts. @chunyu3

@weidongxu-microsoft
Copy link
Member Author

@tadelesh
Copy link
Member

tadelesh commented Mar 4, 2025

it is by design for orphan model. we may need to think about adding protocol usage for usage enum.

@weidongxu-microsoft
Copy link
Member Author

it is by design for orphan model. we may need to think about adding protocol usage for usage enum.

created a discussion #2311

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

Successfully merging a pull request may close this issue.

3 participants