Skip to content

Feature Request: Option to generate max overloads (WithResponse methods) with models #10742

@srnagar

Description

@srnagar

Clear and concise description of the problem

We should have an option to generate the max overloads (WithResponse methods) with models instead of BinaryData. We should have support for generating with just models, just BinaryData or both.

In tspconfig.yaml:

"@azure-tools/typespec-java":
  namespace: "com.azure.sample.library"
  partial-update: true
  flavor: azure
  max-overload: all

The above config should generate the following two methods:

public Response<BinaryData> createFooWithResponse(BinaryData createFooOptions, RequestOptions requestOptions); // protocol method 

public Response<FooDetails> createFooWithResponse(CreateFooOptions createFooOptions, RequestOptions requestOptions); // max overload with models

The other values for max-overload config would be protocol or model.

For scenarios where we can only support protocol methods (like patch or MFD), we ignore this flag and generate only protocol methods.

When the config is set to all and the WithResponse overloads for protocol and model differs only in the return type (i.e. the input params are identical and therefore cannot have overloads based on just return type), then we fall back to protocol method (existing behavior).

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.

Metadata

Metadata

Labels

emitter:client:javaIssue for the Java client emitter: @typespec/http-client-javafeatureNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions