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

http-client-java, adopt TCGC usage and access #4854

Draft
wants to merge 28 commits into
base: main
Choose a base branch
from

Conversation

haolingdong-msft
Copy link
Member

@haolingdong-msft haolingdong-msft commented Oct 24, 2024

PR shows the diff cases after adopting TCGC and summarized the cause of each diff.

WIP on emitter part, so no need to review yet.

TCGC dependencies are tracked in this issue: Azure/autorest.java#2931

@microsoft-github-policy-service microsoft-github-policy-service bot added the emitter:client:java Issue for the Java client emitter: @typespec/http-client-java label Oct 24, 2024
@azure-sdk
Copy link
Collaborator

No changes needing a change description found.

@azure-sdk
Copy link
Collaborator

You can try these changes here

🛝 Playground 🌐 Website 📚 Next docs

/**
* Repeatability Result header options.
*/
public enum RepeatabilityResult {
Copy link
Member Author

@haolingdong-msft haolingdong-msft Oct 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caused by this case1

/**
* Enum describing allowed operation states.
*/
public final class OperationState extends ExpandableStringEnum<OperationState> {
Copy link
Member Author

@haolingdong-msft haolingdong-msft Oct 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caused by case1 and case2

@@ -150,7 +150,7 @@ public final class Builtin implements JsonSerializable<Builtin> {
* @param encoded the encoded value to set.
*/
@Generated
public Builtin(boolean booleanProperty, String string, byte[] bytes, int intProperty, long safeint,
Copy link
Member Author

@haolingdong-msft haolingdong-msft Oct 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is expected as Builltin and Encoded are used in operation whose convenientAPI == false

@@ -63,7 +63,7 @@ enum OperationStateValues {
Failed,
}

@usage(Usage.input)
@usage(Usage.input | Usage.output)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

update the test case as the definition is invalid.

* The LroOperationStatusError model.
*/
@Immutable
public final class LroOperationStatusError implements JsonSerializable<LroOperationStatusError> {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caused by case1 and case2

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caused by case3

import com.cadl.multicontenttypes.implementation.MultipleContentTypesOnRequestsImpl;
import com.cadl.multicontenttypes.models.Resource;
import reactor.core.publisher.Mono;

/**
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caused by case7

@@ -71,6 +73,7 @@ interface MultipleContentTypesOnRequest {
@route("upload/multi-body-types")
@sharedRoute
@post
@convenientAPI(false)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cause by case7. We agree to add @convenientAPI(false) to the operation.

@@ -92,8 +90,6 @@ public Mono<Response<Void>> uploadBytesWithSingleBodyTypeForMultiContentTypesWit
@ServiceMethod(returns = ReturnType.SINGLE)
public Mono<Response<Void>> uploadBytesWithMultiBodyTypesForMultiContentTypesWithResponse(String contentType,
BinaryData data, RequestOptions requestOptions) {
// Convenience API is not generated, as operation 'uploadBytesWithMultiBodyTypesForMultiContentTypes' is
Copy link
Member Author

@haolingdong-msft haolingdong-msft Oct 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm working on the javadoc and error message when user does not set convenientAPI(false)


/**
* The actual serialized value for a RepeatabilityResult instance.
*/
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caused by case1

@@ -0,0 +1,150 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caused by case2

*/
public final class OperationState extends ExpandableStringEnum<OperationState> {
/**
* The operation has not started.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caused by case2

/**
* Defines values for ClientType.
*/
public enum ClientType {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caused by case8

/**
* Enum value accepted.
*/
ACCEPTED("accepted"),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caused by case1

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caused by case3

@@ -997,7 +1001,6 @@ export class CodeModelBuilder {
}
}

// track usage
if (pollingSchema) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did not remove this part because of this TCGC issue: Azure/typespec-azure#1752

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

Successfully merging this pull request may close these issues.

2 participants