microsoft / microsoft/typespec
[Bug]: Subclass conctructor generation contains unexpected `String object` field
- Dominant language
- Java
- Stars
- 5.9k
- Forks
- 394
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 104
Description
### Describe the bug
I am working on generating a Java client library for the Azure OpenAI Realtime Audio service in this [PR](https://github.com/Azure/azure-sdk-for-java/pull/42707). The code generation is based of [this TSP specification](https://github.com/joseharriaga/openai-in-typespec/pull/325).
The issue injects a `String object` parameter to the constructor of the `RealtimeResponseMessageItem`, `RealtimeResponseFunctionCallOutputItem` classes which causes an error for the deserialization method.
### Reproduction
By using the `tsp-client sync` and `tsp-client generate` commands, one can reproduce the issue currently with the repository in the present state of the PR linked in the description of the issue (https://github.com/Azure/azure-sdk-for-java/pull/42707)
This results in the following constructors being generated for their respective classes:
```java
@Generated
private RealtimeResponseFunctionCallOutputItem(String object, String id, String callId, String output) {
super(object, id);
this.callId = callId;
this.output = output;
}
```
and
```java
@Generated
private RealtimeResponseFunctionCallItem(String object, String id, String name, String callId, String arguments,
RealtimeItemStatus status) {
super(object, id);
this.name = name;
this.callId = callId;
this.arguments = arguments;
this.status = status;
}
```
### Checklist
- [x] Follow our [Code of Conduct](https://github.com/microsoft/typespec/blob/main/CODE_OF_CONDUCT.md)
- [x] Check that there isn't already an issue that request the same bug to avoid creating a duplicate.
- [x] Check that this is a concrete bug. For Q&A open a [GitHub Discussion](https://github.com/Microsoft/typespec/discussions).
- [x] The provided reproduction is a [minimal reproducible example](https://stackoverflow.com/help/minimal-reproducible-example) of the bug.
Contributor guide
Assessment
This issue has not been assessed yet.