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

[Unbranded Client CodeGen]: Support generating error models instead of reusing the model from core library #5203

Open
4 tasks
lirenhe opened this issue Nov 27, 2024 · 2 comments
Labels
1_0_E2E emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp emitter:client:java Issue for the Java client emitter: @typespec/http-client-java emitter:client:python Issue for the Python client emitter: @typespec/http-client-python epic

Comments

@lirenhe
Copy link
Member

lirenhe commented Nov 27, 2024

Clear and concise description of the problem

For unbranded client generation, today, we still use the models from core library when we see the following code which is not correct.
In the unbranded scenario, we should generate models for each Error decorated by @error .

@error
model ApiError {
  /** A machine readable error code */
  code: string;

  /** A human readable message */
  // https://github.com/microsoft/OpenAPI/blob/main/extensions/x-ms-primary-error-message.md
  @OpenAPI.extension("x-ms-primary-error-message", true)
  message: string;
}

Checklist

  • Follow our Code of Conduct
  • Read the docs.
  • Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
@lirenhe lirenhe added emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp emitter:client:java Issue for the Java client emitter: @typespec/http-client-java emitter:client:python Issue for the Python client emitter: @typespec/http-client-python 1_0_E2E labels Nov 27, 2024
@lirenhe lirenhe added the epic label Nov 27, 2024
@lirenhe lirenhe changed the title [Unbranded Client CodeGen]: Support generating error models from TypeSpec definition instead of reusing the model from core library [Unbranded Client CodeGen]: Support generating error models instead of reusing the model from core library Nov 27, 2024
@MaryGao
Copy link
Member

MaryGao commented Nov 27, 2024

@lirenhe @lmazuel I'd like to clarify the requirement here, when we talk about supporting error model generation, do we talk about the following 1 or both?

  • first we need to generate these customized error models and expose to end users
  • second our client should serialize to that error model if the error code is matching

@lirenhe
Copy link
Member Author

lirenhe commented Nov 27, 2024

@lirenhe @lmazuel I'd like to clarify the requirement here, when we talk about supporting error model generation, do we talk about the following 1 or both?

  • first we need to generate these customized error models and expose to end users
  • second our client should serlize to that error model if the error code is matching

It should be both, but currently, we don't generate error models so I am not sure the status of (2).
For those issues created for each emitter, I already added the verification of the range of the status code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1_0_E2E emitter:client:csharp Issue for the C# client emitter: @typespec/http-client-csharp emitter:client:java Issue for the Java client emitter: @typespec/http-client-java emitter:client:python Issue for the Python client emitter: @typespec/http-client-python epic
Projects
None yet
Development

No branches or pull requests

2 participants