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

Azure Container Apps session data plane #30424

Merged
merged 133 commits into from
Nov 4, 2024

Conversation

yitaopan
Copy link
Member

@yitaopan yitaopan commented Sep 4, 2024

Choose a PR Template

Switch to "Preview" on this description then select one of the choices below.

Click here to open a PR for a Data Plane API.

Click here to open a PR for a Control Plane (ARM) API.

fix #30393

Copy link
Member

@allenjzhang allenjzhang left a comment

Choose a reason for hiding this comment

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

Please take a look and try to snap to standard operations.

#suppress "@azure-tools/typespec-azure-core/use-standard-operations" ""
@doc("Execute code in a session.")
@route("/execute:executeCode")
executeCode is Foundations.Operation<
Copy link
Member

Choose a reason for hiding this comment

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

Looking at your Execution, it is still resource like. Please see playground to see how to model it and use the standard operation template.

#suppress "@azure-tools/typespec-azure-core/use-standard-operations" ""
@doc("Get the content of the file.")
@route("/files/{name}/content")
getFileContent is Foundations.Operation<
Copy link
Member

Choose a reason for hiding this comment

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

This fits the ResourceAction perfectly. See playground

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank for the comments and sample code in playground, I am able to update the original GetExecutionResult to use standard operation.

But for execute code, the request body is model SessionCodeExecutionRequest and is different from the response SessionCodeExecutionResource, so LongRunningResourceCreateWithServiceProvidedName might not be a perfect fit in this case.

And for GetFileContent, using ResourceAction would let this Api become a POST operation rather than a GET, so I was't able to update to use ResourceAction.

Are there any suggestions for this scenario? Thanks!

Copy link
Member

Choose a reason for hiding this comment

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

Actually the playground countains another example for the getContent using ResourceAction.

I pulled your PR and used following code and it produced same swagger

  #suppress "@azure-tools/typespec-azure-core/verb-conflict" "GET allowed on Action"
  @action("content")
  @actionSeparator("/")
  @doc("Get the content of the file.")
  @get
  getContent is SessionResourceFilesOperations.ResourceAction<
    SessionResourceFile,
    {},
    {
      @body _: bytes;
    }
  >;

Please also remove now unused model SessionResourceFileNamePathParameter from models/common.tsp.

Copy link
Member

Choose a reason for hiding this comment

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

I will remove -1 on the review as I will be OOF tomorrow. But please do fix this.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you, this is fixed now


#suppress "@azure-tools/typespec-azure-core/no-unknown" ""
@doc("The result of the code execution. The type of this field is same as the type of actual result of the code execution after being Json serialized.")
executionResult?: unknown;
Copy link
Member

Choose a reason for hiding this comment

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

If this is a JSON result, please use Record<unknown>

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, fixed.

Copy link
Member Author

@yitaopan yitaopan Nov 1, 2024

Choose a reason for hiding this comment

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

Hi, had to revert this as this executionResult is not a Json object but rather a Json value

],
"security": [
{
"AadOauth2Auth": [
Copy link
Contributor

Choose a reason for hiding this comment

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

should it start from lower case?

Copy link
Member Author

Choose a reason for hiding this comment

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

This is auto generated by TypeSpec, I searched other projects in this repo also found several similar patterns, I think it might be fine.

}
],
"responses": {
"202": {
Copy link
Contributor

Choose a reason for hiding this comment

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

only 202 is allowed to return? what about 200?

Copy link
Member Author

Choose a reason for hiding this comment

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

This follows this guideline to only return 202 not 200 for LRO as a previous comment says

}
},
"post": {
"operationId": "SessionResourceFiles_UploadFile",
Copy link
Contributor

Choose a reason for hiding this comment

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

upload is not long running?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, currently only execute code can be long running

}
},
"delete": {
"operationId": "SessionResourceFiles_DeleteFile",
Copy link
Contributor

Choose a reason for hiding this comment

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

delete is not long running?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, currently only execute code can be long running

},
"x-ms-identifiers": []
},
"innererror": {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"innererror": {
"innerError": {

Copy link
Member Author

Choose a reason for hiding this comment

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

This is also auto-generated by TypeSpec

"type": "string",
"description": "One of a server-defined set of error codes."
},
"innererror": {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"innererror": {
"innerError": {

Copy link
Member Author

Choose a reason for hiding this comment

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

This is also auto-generated by TypeSpec

"items": {
"$ref": "#/definitions/SessionResourceFile"
},
"x-ms-identifiers": []
Copy link
Contributor

Choose a reason for hiding this comment

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

should name be identifiers?

Copy link
Member

@allenjzhang allenjzhang left a comment

Choose a reason for hiding this comment

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

See comment on getContent. Consider signed off with that fixed.

@allenjzhang allenjzhang dismissed their stale review October 25, 2024 06:57

OOF so no blocking

@yitaopan yitaopan added the PublishToCustomers Acknowledgement the changes will be published to Azure customers. label Nov 1, 2024
@mikekistler mikekistler added the APIStewardshipBoard-SignedOff The Azure API Stewardship team has reviewed and approved the changes. label Nov 1, 2024
@yitaopan yitaopan merged commit 2f5e161 into Azure:main Nov 4, 2024
28 of 30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
APIStewardshipBoard-SignedOff The Azure API Stewardship team has reviewed and approved the changes. data-plane new-api-version PublishToCustomers Acknowledgement the changes will be published to Azure customers. TypeSpec Authored with TypeSpec
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Azure Container Apps - Azure Container Apps] API Review
8 participants