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

use body root to specify which parameter models we want to keep grouped #29483

Merged
merged 34 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
c01768b
add ops.ResourceCollectionAction KeepModel
Jun 18, 2024
cb321f1
add ops.ResourceAction KeepModel
Jun 18, 2024
199803d
add ops.LongRunningResourceAction KeepModel
Jun 18, 2024
c42df35
other templates
Jun 18, 2024
3b6cb5f
switch over to BodyParameter
Jun 19, 2024
038dad8
format
Jun 20, 2024
e0b9e20
use valueof in BodyParameter template, add doc
Jun 20, 2024
ffb91da
Merge branch 'main' of https://github.com/Azure/azure-rest-api-specs …
Jun 20, 2024
f11aea7
remove unnecessary documentation
Jun 20, 2024
d940004
add doc to BodyParameter template
Jun 21, 2024
440d9d1
add extra specs
Jun 21, 2024
40c6515
Merge branch 'main' of https://github.com/Azure/azure-rest-api-specs …
Jun 21, 2024
1d3cba4
fix formatting of BodyParameter
Jun 24, 2024
1727265
format
Jun 24, 2024
d11bb45
Merge branch 'main' of https://github.com/Azure/azure-rest-api-specs …
Jun 24, 2024
ed34a0b
format
Jun 24, 2024
20e479f
format
Jun 24, 2024
ce72061
suppress doc warning
Jun 25, 2024
5e96ec7
Merge branch 'main' of https://github.com/Azure/azure-rest-api-specs …
Jun 25, 2024
be1c649
move body parameter to template
Jun 25, 2024
6c4bb65
add default body parameter doc
Jun 25, 2024
3bc73a2
default bodyparam doc to body parameter
Jun 25, 2024
bd68bb7
fix validation errors
Jun 25, 2024
3ea816d
remove bodyparameter from codetransparency
Jun 25, 2024
fa2f327
try for openai
Jun 25, 2024
8eeabae
remove incorrect alias bodyparameter
Jun 25, 2024
628a3e0
don't spread CreateLivenessWithVerifySessionContent
Jun 25, 2024
a8d0a5b
fix breaking change in easm
Jun 25, 2024
0fa93ff
add readme to openai assistants
Jun 26, 2024
2d89c52
update readme
Jun 26, 2024
b0eecac
add tag to readme
Jun 26, 2024
d7f5eaf
fix json file reference
Jun 26, 2024
a99b0d5
add json files to list
Jun 26, 2024
eed58b8
Merge branch 'main' into body_root_params
markcowl Jun 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions specification/ai/Face/models.common.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -294,3 +294,14 @@ model FaceError {
}

model FaceErrorResponse is Azure.Core.Foundations.ErrorResponseBase<FaceError>;

alias BodyParameter<
T,
TName extends valueof string = "body",
TDoc extends valueof string = "Body parameter."
> = {
@doc(TDoc)
@friendlyName(TName)
@bodyRoot
body: T;
};
4 changes: 2 additions & 2 deletions specification/ai/Face/routes.session.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ interface LivenessSessionOperations {
@returnsDoc(SessionCreationSuccess)
createLivenessSession is FaceResourceCreateWithServiceProvidedName<
LivenessSession,
CreateLivenessSessionContent,
BodyParameter<CreateLivenessSessionContent>,
CreateLivenessSessionResult
>;

Expand Down Expand Up @@ -118,7 +118,7 @@ interface LivenessSessionOperations {
@sharedRoute
createLivenessWithVerifySession is FaceResourceCreateWithServiceProvidedName<
LivenessWithVerifySession,
CreateLivenessSessionContent,
BodyParameter<CreateLivenessSessionContent>,
CreateLivenessWithVerifySessionResult
>;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,3 +229,14 @@ model ClinicalCodedElement {
@doc("A value associated with the code within the given clinical coding system.")
value?: string;
}

alias BodyParameter<
T,
TName extends valueof string = "body",
TDoc extends valueof string = "Body parameter."
> = {
@doc(TDoc)
@friendlyName(TName)
@bodyRoot
body: T;
};
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ interface OncoPhenotype {
@doc("Gets the status and details of the Onco Phenotype job.")
@get
@route("/onco-phenotype/jobs/{id}")
getJob is HealthInsightsLongRunningPollOperation<OncoPhenotypeResult>;
getJob is HealthInsightsLongRunningPollOperation<BodyParameter<OncoPhenotypeResult>>;

#suppress "@azure-tools/typespec-azure-core/long-running-polling-operation-required" "Polling through operation-location"
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "There is no long-running RPC template in Azure.Core"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ interface PatientTimeline {
@doc("Gets the status and details of the Patient Timeline job.")
@get
@route("/patient-timeline/jobs/{id}")
getJob is HealthInsightsLongRunningPollOperation<PatientTimelineResult>;
getJob is HealthInsightsLongRunningPollOperation<BodyParameter<PatientTimelineResult>>;

#suppress "@azure-tools/typespec-azure-core/long-running-polling-operation-required" "Polling through operation-location"
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "There is no long-running RPC template in Azure.Core"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ interface TrialMatcher {
@doc("Gets the status and details of the Trial Matcher job.")
@get
@route("/trial-matcher/jobs/{id}")
getJob is HealthInsightsLongRunningPollOperation<TrialMatcherResult>;
getJob is HealthInsightsLongRunningPollOperation<BodyParameter<TrialMatcherResult>>;

#suppress "@azure-tools/typespec-azure-core/long-running-polling-operation-required" "Polling through operation-location"
#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "There is no long-running RPC template in Azure.Core"
Expand Down
4 changes: 2 additions & 2 deletions specification/ai/OpenAI.Assistants/assistants/routes.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ namespace Azure.AI.OpenAI.Assistants;
@post
@added(ServiceApiVersions.v2024_02_15_preview)
@route("/assistants")
op createAssistant(...AssistantCreationOptions): Assistant;
op createAssistant(...BodyParameter<AssistantCreationOptions>): Assistant;

/**
* Gets a list of assistants that were previously created.
Expand Down Expand Up @@ -63,7 +63,7 @@ op getAssistant(@path assistantId: string): Assistant;
@post
@route("/assistants/{assistantId}")
@added(ServiceApiVersions.v2024_02_15_preview)
op updateAssistant(...UpdateAssistantOptions): Assistant;
op updateAssistant(...BodyParameter<UpdateAssistantOptions>): Assistant;

/**
* Deletes an assistant.
Expand Down
11 changes: 11 additions & 0 deletions specification/ai/OpenAI.Assistants/common/models.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,14 @@ union ApiResponseFormat {
/** Using `json_object` format will limit the usage of ToolCall to only functions. */
jsonObject: "json_object",
}

alias BodyParameter<
T,
TName extends valueof string = "body",
TDoc extends valueof string = "Body parameter."
> = {
@doc(TDoc)
@friendlyName(TName)
@bodyRoot
body: T;
};
2 changes: 1 addition & 1 deletion specification/ai/OpenAI.Assistants/runs/routes.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -139,4 +139,4 @@ op cancelRun(@path threadId: string, @path runId: string): ThreadRun;
@route("/threads/runs")
@doc("Creates a new assistant thread and immediately starts a run using that new thread.")
@added(ServiceApiVersions.v2024_02_15_preview)
op createThreadAndRun(...CreateAndRunThreadOptions): ThreadRun;
op createThreadAndRun(...BodyParameter<CreateAndRunThreadOptions>): ThreadRun;
8 changes: 6 additions & 2 deletions specification/ai/OpenAI.Assistants/threads/routes.tsp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ namespace Azure.AI.OpenAI.Assistants;
@post
@added(ServiceApiVersions.v2024_02_15_preview)
@route("/threads")
op createThread(...AssistantThreadCreationOptions): AssistantThread;
op createThread(
...BodyParameter<AssistantThreadCreationOptions>,
): AssistantThread;

// list threads?

Expand Down Expand Up @@ -52,7 +54,9 @@ op getThread(@path threadId: string): AssistantThread;
@post
@route("/threads/{threadId}")
@added(ServiceApiVersions.v2024_02_15_preview)
op updateThread(...UpdateAssistantThreadOptions): AssistantThread;
op updateThread(
...BodyParameter<UpdateAssistantThreadOptions>,
): AssistantThread;

/**
* Deletes an existing thread.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ op listVectorStores(
@post
@route("/vector_stores")
@added(ServiceApiVersions.v2024_05_01_preview)
op createVectorStore(...VectorStoreOptions): VectorStore;
op createVectorStore(...BodyParameter<VectorStoreOptions>): VectorStore;

/**
* Returns the vector store object matching the specified ID.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -408,6 +408,7 @@
{
"name": "body",
"in": "body",
"description": "Body parameter.",
"required": true,
"schema": {
"$ref": "#/definitions/CreateLivenessSessionContent"
Expand Down Expand Up @@ -5846,6 +5847,7 @@
{
"name": "body",
"in": "body",
"description": "Body parameter.",
"required": true,
"schema": {
"$ref": "#/definitions/CreateLivenessSessionContent"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@
{
"name": "body",
"in": "body",
"description": "Body parameter.",
"required": true,
"schema": {
"$ref": "#/definitions/AssistantCreationOptions"
Expand Down Expand Up @@ -217,11 +218,16 @@
"description": "Modifies an existing assistant.",
"parameters": [
{
"$ref": "#/parameters/UpdateAssistantOptions.assistantId"
"name": "assistantId",
"in": "path",
"description": "The ID of the assistant to modify.",
"required": true,
"type": "string"
},
{
"name": "body",
"in": "body",
"description": "Body parameter.",
"required": true,
"schema": {
"$ref": "#/definitions/UpdateAssistantOptions"
Expand Down Expand Up @@ -460,6 +466,7 @@
{
"name": "body",
"in": "body",
"description": "Body parameter.",
"required": true,
"schema": {
"$ref": "#/definitions/AssistantThreadCreationOptions"
Expand Down Expand Up @@ -503,11 +510,16 @@
"description": "Modifies an existing thread.",
"parameters": [
{
"$ref": "#/parameters/UpdateAssistantThreadOptions.threadId"
"name": "threadId",
"in": "path",
"description": "The ID of the thread to modify.",
"required": true,
"type": "string"
},
{
"name": "body",
"in": "body",
"description": "Body parameter.",
"required": true,
"schema": {
"$ref": "#/definitions/UpdateAssistantThreadOptions"
Expand Down Expand Up @@ -1235,6 +1247,7 @@
{
"name": "body",
"in": "body",
"description": "Body parameter.",
"required": true,
"schema": {
"$ref": "#/definitions/CreateAndRunThreadOptions"
Expand Down Expand Up @@ -3181,22 +3194,5 @@
}
}
},
"parameters": {
"UpdateAssistantOptions.assistantId": {
"name": "assistantId",
"in": "path",
"description": "The ID of the assistant to modify.",
"required": true,
"type": "string",
"x-ms-parameter-location": "method"
},
"UpdateAssistantThreadOptions.threadId": {
"name": "threadId",
"in": "path",
"description": "The ID of the thread to modify.",
"required": true,
"type": "string",
"x-ms-parameter-location": "method"
}
}
"parameters": {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@
{
"name": "body",
"in": "body",
"description": "Body parameter.",
"required": true,
"schema": {
"$ref": "#/definitions/AssistantCreationOptions"
Expand Down Expand Up @@ -217,11 +218,16 @@
"description": "Modifies an existing assistant.",
"parameters": [
{
"$ref": "#/parameters/UpdateAssistantOptions.assistantId"
"name": "assistantId",
"in": "path",
"description": "The ID of the assistant to modify.",
"required": true,
"type": "string"
},
{
"name": "body",
"in": "body",
"description": "Body parameter.",
"required": true,
"schema": {
"$ref": "#/definitions/UpdateAssistantOptions"
Expand Down Expand Up @@ -496,6 +502,7 @@
{
"name": "body",
"in": "body",
"description": "Body parameter.",
"required": true,
"schema": {
"$ref": "#/definitions/AssistantThreadCreationOptions"
Expand Down Expand Up @@ -539,11 +546,16 @@
"description": "Modifies an existing thread.",
"parameters": [
{
"$ref": "#/parameters/UpdateAssistantThreadOptions.threadId"
"name": "threadId",
"in": "path",
"description": "The ID of the thread to modify.",
"required": true,
"type": "string"
},
{
"name": "body",
"in": "body",
"description": "Body parameter.",
"required": true,
"schema": {
"$ref": "#/definitions/UpdateAssistantThreadOptions"
Expand Down Expand Up @@ -1287,6 +1299,7 @@
{
"name": "body",
"in": "body",
"description": "Body parameter.",
"required": true,
"schema": {
"$ref": "#/definitions/CreateAndRunThreadOptions"
Expand Down Expand Up @@ -1418,6 +1431,7 @@
{
"name": "body",
"in": "body",
"description": "Body parameter.",
"required": true,
"schema": {
"$ref": "#/definitions/VectorStoreOptions"
Expand Down Expand Up @@ -5172,22 +5186,5 @@
}
}
},
"parameters": {
"UpdateAssistantOptions.assistantId": {
"name": "assistantId",
"in": "path",
"description": "The ID of the assistant to modify.",
"required": true,
"type": "string",
"x-ms-parameter-location": "method"
},
"UpdateAssistantThreadOptions.threadId": {
"name": "threadId",
"in": "path",
"description": "The ID of the thread to modify.",
"required": true,
"type": "string",
"x-ms-parameter-location": "method"
}
}
"parameters": {}
}
Loading