diff --git a/eng/pipelines/templates/steps/typespec-ci.yml b/eng/pipelines/templates/steps/typespec-ci.yml index 03617810c098..064c647087a2 100644 --- a/eng/pipelines/templates/steps/typespec-ci.yml +++ b/eng/pipelines/templates/steps/typespec-ci.yml @@ -24,17 +24,16 @@ steps: fi # Pass "--no" to ensure npx does not install anything (TypeSpec compiler should already be installed) - + if test -f main.tsp; then npx --no tsp compile . --warn-as-error || exit_code=1 fi if test -f client.tsp; then npx --no tsp compile client.tsp --no-emit --warn-as-error || exit_code=1 fi - - # Format parent folder to include shared files (disabled until formatting diffs are fixed) - # npx tsp format ../**/*.tsp + # Format parent folder to include shared files + npx tsp format ../**/*.tsp popd diff --git a/specification/cognitiveservices/AnomalyDetector/client.tsp b/specification/cognitiveservices/AnomalyDetector/client.tsp index 22c2c04080fe..88e9ed69cbf4 100644 --- a/specification/cognitiveservices/AnomalyDetector/client.tsp +++ b/specification/cognitiveservices/AnomalyDetector/client.tsp @@ -3,4 +3,4 @@ import "./main.tsp"; using Azure.ClientGenerator.Core; -@@convenientAPI(AnomalyDetector.Univariate.detectUnivariateEntireSeries, false) +@@convenientAPI(AnomalyDetector.Univariate.detectUnivariateEntireSeries, false); diff --git a/specification/cognitiveservices/AnomalyDetector/main.tsp b/specification/cognitiveservices/AnomalyDetector/main.tsp index 8e6a6e3ca9d4..bb7f65c777af 100644 --- a/specification/cognitiveservices/AnomalyDetector/main.tsp +++ b/specification/cognitiveservices/AnomalyDetector/main.tsp @@ -9,7 +9,9 @@ using TypeSpec.Http; using TypeSpec.Versioning; @versioned(APIVersion) -@service({title: "Anomaly Detector"}) +@service({ + title: "Anomaly Detector", +}) @useAuth(AnomalyDetectorApiKeyAuth) @server( "{Endpoint}/anomalydetector/{ApiVersion}", @@ -20,7 +22,7 @@ Supported Azure Cognitive Services endpoints (protocol and host name, such as https://westus2.api.cognitive.microsoft.com). """) Endpoint: string, - + @doc("Api Version") @path ApiVersion: APIVersion, @@ -47,7 +49,8 @@ discover incidents and establish a logic flow for root cause analysis. namespace AnomalyDetector; @doc("The secret key for your Azure Cognitive Services subscription.") -model AnomalyDetectorApiKeyAuth is ApiKeyAuth; +model AnomalyDetectorApiKeyAuth + is ApiKeyAuth; #suppress "@azure-tools/typespec-azure-core/documentation-required" "https://github.com/Azure/typespec-azure/issues/3107" enum APIVersion { diff --git a/specification/cognitiveservices/AnomalyDetector/multivariate/models.tsp b/specification/cognitiveservices/AnomalyDetector/multivariate/models.tsp index d6605de5e703..bc44d4a8848d 100644 --- a/specification/cognitiveservices/AnomalyDetector/multivariate/models.tsp +++ b/specification/cognitiveservices/AnomalyDetector/multivariate/models.tsp @@ -11,11 +11,11 @@ namespace AnomalyDetector.Multivariate; #suppress "@azure-tools/typespec-azure-core/documentation-required" "MUST fix in next update" @doc("Field that indicates how missing values will be filled.") enum FillNAMethod { - "Previous", - "Subsequent", - "Linear", - "Zero", - "Fixed", + Previous, + Subsequent, + Linear, + Zero, + Fixed, } #suppress "@azure-tools/typespec-azure-core/documentation-required" "MUST fix in next update" @@ -29,25 +29,29 @@ enum MultivariateBatchDetectionStatus { @doc("Data schema of the input data source. The default is OneTable.") enum DataSchema { @doc("OneTable means that your input data is in one CSV file, which contains one time stamp column and several variable columns. The default DataSchema value is OneTable.") - "OneTable", + OneTable, + @doc("MultiTable means that your input data is separated in multiple CSV files. Each file contains one time stamp column and one variable column, and the CSV file name should indicate the name of the variable. The default DataSchema value is OneTable.") - "MultiTable", + MultiTable, } #suppress "@azure-tools/typespec-azure-core/documentation-required" "MUST fix in next update" enum AlignMode { - "Inner", - "Outer", + Inner, + Outer, } #suppress "@azure-tools/typespec-azure-core/documentation-required" "MUST fix in next update" enum ModelStatus { @doc("The model has been created. Training has been scheduled but not yet started.") Created: "CREATED", + @doc("The model is being trained.") Running: "RUNNING", + @doc("The model has been trained and is ready to be used for anomaly detection.") Ready: "READY", + @doc("The model training failed.") Failed: "FAILED", } @@ -75,6 +79,7 @@ model MultivariateBatchDetectionResultSummary { @doc("Error message when detection fails.") errors?: ErrorResponse[]; + @doc("Variable status.") variableStates?: VariableState[]; @@ -88,7 +93,6 @@ will need another API to get detection results. @doc("Error information that the API returned.") @error model ErrorResponse { - @doc("Error code.") code: string; @@ -154,6 +158,7 @@ be in ISO 8601 format. model AnomalyState { @doc("Time stamp for this anomaly.") timestamp: utcDateTime; + @doc("Detailed value of this anomalous time stamp.") value?: AnomalyValue; @@ -180,6 +185,7 @@ Raw anomaly score of severity, to help indicate the degree of abnormality. @minValue(0.0) @maxValue(2.0) score: float32; + @doc("Interpretation of this anomalous time stamp.") interpretation?: AnomalyInterpretation[]; } @@ -194,6 +200,7 @@ This score shows the percentage that contributes to the anomalous time stamp. It number between 0 and 1. """) contributionScore?: float32; + @doc("Correlation changes among the anomalous variables.") correlationChanges?: CorrelationChanges; } @@ -285,6 +292,7 @@ Field that indicates how missing values will be filled. model DiagnosticsInfo { @doc("Model status.") modelState?: ModelState; + @doc("Variable status.") variableStates?: VariableState[]; } @@ -381,11 +389,11 @@ model VariableValues { values: float32[]; } - @doc("Results of the last detection.") model MultivariateLastDetectionResult { @doc("Variable status.") variableStates?: VariableState[]; + @doc("Anomaly status and information.") results?: AnomalyState[]; } @@ -395,6 +403,6 @@ model MultivariateLastDetectionResult { model ResponseError { @header("x-ms-error-code") @doc("Error code.") - msErrorCode?: string, - ...ErrorResponse + msErrorCode?: string; + ...ErrorResponse; } diff --git a/specification/cognitiveservices/AnomalyDetector/multivariate/routes.tsp b/specification/cognitiveservices/AnomalyDetector/multivariate/routes.tsp index 3a752ba6e6c8..d74eff349b26 100644 --- a/specification/cognitiveservices/AnomalyDetector/multivariate/routes.tsp +++ b/specification/cognitiveservices/AnomalyDetector/multivariate/routes.tsp @@ -34,7 +34,8 @@ resultId value that the BatchDetectAnomaly API returns. op getMultivariateBatchDetectionResult( @format("uuid") @doc("ID of a batch detection result.") - @path resultId: string, + @path + resultId: string ): MultivariateDetectionResult | ResponseError; #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Azure core RpcOperation does not support custom error response" @@ -57,15 +58,19 @@ op trainMultivariateModel is MultivariateServiceAction< // TParams { @doc("Model information.") - @body modelInfo: ModelInfo, + @body + modelInfo: ModelInfo; }, // TResponse { - @statusCode statusCode: 201, + @statusCode statusCode: 201; + @doc("Location and ID of the model.") - @header location: string, - @body result: AnomalyDetectionModel - }>; + @header + location: string; + @body result: AnomalyDetectionModel; + } +>; #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Does not fit any standard operation pattern" // This operation does not fit any standard operation pattern. @@ -79,10 +84,9 @@ op trainMultivariateModel is MultivariateServiceAction< @doc("List models of a resource.") op listMultivariateModels( ...SkipQueryParameter, - ...TopQueryParameter, + ...TopQueryParameter ): ModelList | ResponseError; - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Does not fit any standard operation pattern" // This operation does not fit any standard operation pattern. // The closest match is probably ResourceDelete, but that can't be used because @@ -94,13 +98,12 @@ op listMultivariateModels( op deleteMultivariateModel( @doc("Model identifier.") @path - modelId: string, + modelId: string ): { @doc("Delete model successfully.") @statusCode - statusCode: 204 - } | ResponseError; - + statusCode: 204; +} | ResponseError; #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Does not fit any standard operation pattern" // This operation does not fit any standard operation pattern. @@ -116,7 +119,7 @@ and variables used in the model. op getMultivariateModel( @doc("Model identifier.") @path - modelId: string, + modelId: string ): AnomalyDetectionModel | ResponseError; #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Does not fit any standard operation pattern" @@ -138,18 +141,23 @@ op detectMultivariateBatchAnomaly( @doc("Model identifier.") @path modelId: string, + @doc("Request of multivariate anomaly detection.") - @body options: MultivariateBatchDetectionOptions, + @body + options: MultivariateBatchDetectionOptions ): { - @statusCode statusCode: 202, + @statusCode statusCode: 202; + @doc("ID of the detection result.") - @header("Operation-Id") operationId: string, + @header("Operation-Id") + operationId: string; + @doc("Location of the detection result.") - @header("Operation-Location") operationLocation: string, - @body result: MultivariateDetectionResult, + @header("Operation-Location") + operationLocation: string; + @body result: MultivariateDetectionResult; } | ResponseError; - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Does not fit any standard operation pattern" // This operation does not fit any standard operation pattern. // The closest match is probably ResourceAction, but that can't be used because @@ -166,6 +174,8 @@ op detectMultivariateLastAnomaly( @doc("Model identifier.") @path modelId: string, + @doc("Request of the last detection.") - @body options: MultivariateLastDetectionOptions, + @body + options: MultivariateLastDetectionOptions ): MultivariateLastDetectionResult | ResponseError; diff --git a/specification/cognitiveservices/AnomalyDetector/univariate/models.tsp b/specification/cognitiveservices/AnomalyDetector/univariate/models.tsp index 1a93d1917a00..5b9094ecaca6 100644 --- a/specification/cognitiveservices/AnomalyDetector/univariate/models.tsp +++ b/specification/cognitiveservices/AnomalyDetector/univariate/models.tsp @@ -20,17 +20,17 @@ enum ImputeMode { #suppress "@azure-tools/typespec-azure-core/documentation-required" "MUST fix in next update" enum AnomalyDetectorErrorCodes { - "InvalidCustomInterval", - "BadArgument", - "InvalidGranularity", - "InvalidPeriod", - "InvalidModelArgument", - "InvalidSeries", - "InvalidJsonFormat", - "RequiredGranularity", - "RequiredSeries", - "InvalidImputeMode", - "InvalidImputeFixedValue", + InvalidCustomInterval, + BadArgument, + InvalidGranularity, + InvalidPeriod, + InvalidModelArgument, + InvalidSeries, + InvalidJsonFormat, + RequiredGranularity, + RequiredSeries, + InvalidImputeMode, + InvalidImputeFixedValue, } #suppress "@azure-tools/typespec-azure-core/documentation-required" "MUST fix in next update" @@ -176,7 +176,7 @@ severe the anomaly is. For normal points, the severity is always 0. model AnomalyDetectorError { @header("x-ms-error-code") @doc("Error code.") - msErrorCode: string, + msErrorCode: string; @doc("Error code.") code: AnomalyDetectorErrorCodes; diff --git a/specification/cognitiveservices/AnomalyDetector/univariate/routes.tsp b/specification/cognitiveservices/AnomalyDetector/univariate/routes.tsp index e3ef3a031464..a0b3c79da65f 100644 --- a/specification/cognitiveservices/AnomalyDetector/univariate/routes.tsp +++ b/specification/cognitiveservices/AnomalyDetector/univariate/routes.tsp @@ -29,10 +29,12 @@ op detectUnivariateEntireSeries is UnivariateServiceAction< // TParams { @doc("Method of univariate anomaly detection.") - @body options: UnivariateDetectionOptions, + @body + options: UnivariateDetectionOptions; }, // TResponse - UnivariateEntireDetectionResult>; + UnivariateEntireDetectionResult +>; #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Azure core RpcOperation does not support custom error response" // https://github.com/Azure/typespec-azure/issues/2795 @@ -46,10 +48,12 @@ op detectUnivariateLastPoint is UnivariateServiceAction< // TParams { @doc("Method of univariate anomaly detection.") - @body options: UnivariateDetectionOptions, + @body + options: UnivariateDetectionOptions; }, // TResponse - UnivariateLastDetectionResult>; + UnivariateLastDetectionResult +>; #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Azure core RpcOperation does not support custom error response" // https://github.com/Azure/typespec-azure/issues/2795 @@ -60,7 +64,9 @@ op detectUnivariateChangePoint is UnivariateServiceAction< // TParams { @doc("Method of univariate anomaly detection.") - @body options: UnivariateChangePointDetectionOptions, + @body + options: UnivariateChangePointDetectionOptions; }, // TResponse - UnivariateChangePointDetectionResult>; + UnivariateChangePointDetectionResult +>; diff --git a/specification/cognitiveservices/HealthInsights/healthinsights.oncophenotype/client.tsp b/specification/cognitiveservices/HealthInsights/healthinsights.oncophenotype/client.tsp index 4eddd3696bcb..e329c6e408de 100644 --- a/specification/cognitiveservices/HealthInsights/healthinsights.oncophenotype/client.tsp +++ b/specification/cognitiveservices/HealthInsights/healthinsights.oncophenotype/client.tsp @@ -9,14 +9,16 @@ import "../healthinsights.openapi/service.tsp"; using Azure.ClientGenerator.Core; @TypeSpec.Versioning.useDependency(Azure.Core.Versions.v1_0_Preview_1) -@TypeSpec.Versioning.useDependency(AzureHealthInsights.ApiVersion.v2023_03_01_preview) +@TypeSpec.Versioning.useDependency( + AzureHealthInsights.ApiVersion.v2023_03_01_preview +) namespace ClientForAzureHealthInsights; @client({ - name: "CancerProfilingClient", - service: AzureHealthInsights + name: "CancerProfilingClient", + service: AzureHealthInsights, }) - interface CancerProfilingClient { +interface CancerProfilingClient { #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "https://github.com/microsoft/typespec/issues/2037" inferCancerProfile is AzureHealthInsights.OncoPhenotype.createJob; } diff --git a/specification/cognitiveservices/HealthInsights/healthinsights.oncophenotype/model.oncophenotype.tsp b/specification/cognitiveservices/HealthInsights/healthinsights.oncophenotype/model.oncophenotype.tsp index 812d3dbbc391..adf92080ef4c 100644 --- a/specification/cognitiveservices/HealthInsights/healthinsights.oncophenotype/model.oncophenotype.tsp +++ b/specification/cognitiveservices/HealthInsights/healthinsights.oncophenotype/model.oncophenotype.tsp @@ -9,6 +9,7 @@ namespace AzureHealthInsights; @doc("The body of the Onco Phenotype request.") model OncoPhenotypeData { ...Request; + @doc("Configuration affecting the Onco Phenotype model's inference.") configuration?: OncoPhenotypeModelConfiguration; } @@ -59,6 +60,7 @@ An identifier for a clinical case, if there are multiple clinical cases regardin @doc("Configuration affecting the Onco Phenotype model's inference.") model OncoPhenotypeModelConfiguration { ...ModelConfiguration; + @doc(""" A list of inference types to be inferred for the current request. This could be used if only part of the Onco Phenotype inferences are required. @@ -72,8 +74,6 @@ An indication whether to perform a preliminary step on the patient's documents t checkForCancerCase?: boolean = false; } - - #suppress "@azure-tools/typespec-azure-core/documentation-required" "MUST fix in next update" @doc("The type of the Onco Phenotype inference.") enum OncoPhenotypeInferenceType { diff --git a/specification/cognitiveservices/HealthInsights/healthinsights.openapi/service.tsp b/specification/cognitiveservices/HealthInsights/healthinsights.openapi/service.tsp index 1d38ea71831c..eca08aa8c346 100644 --- a/specification/cognitiveservices/HealthInsights/healthinsights.openapi/service.tsp +++ b/specification/cognitiveservices/HealthInsights/healthinsights.openapi/service.tsp @@ -3,8 +3,9 @@ using TypeSpec.Rest; using TypeSpec.Http; using TypeSpec.Versioning; - -@service({title: "Azure Health Insights"}) +@service({ + title: "Azure Health Insights", +}) @versioned(ApiVersion) @doc("Azure Health Insights provides an API that serves insight models, specific for Health & Life Sciences, that perform analysis and provide inferences to be used by a human.") @server( @@ -15,14 +16,11 @@ using TypeSpec.Versioning; endpoint: url, } ) - @useAuth(ApiKeyAuth) - namespace AzureHealthInsights; #suppress "@azure-tools/typespec-azure-core/documentation-required" "https://github.com/Azure/typespec-azure/issues/3107" enum ApiVersion { @useDependency(Azure.Core.Versions.v1_0_Preview_1) - v2023_03_01_preview: "2023-03-01-preview" + v2023_03_01_preview: "2023-03-01-preview", } - diff --git a/specification/cognitiveservices/HealthInsights/healthinsights.trialmatcher/client.tsp b/specification/cognitiveservices/HealthInsights/healthinsights.trialmatcher/client.tsp index 7d089c72dfac..893313f8d42c 100644 --- a/specification/cognitiveservices/HealthInsights/healthinsights.trialmatcher/client.tsp +++ b/specification/cognitiveservices/HealthInsights/healthinsights.trialmatcher/client.tsp @@ -9,14 +9,16 @@ import "../healthinsights.openapi/service.tsp"; using Azure.ClientGenerator.Core; @TypeSpec.Versioning.useDependency(Azure.Core.Versions.v1_0_Preview_1) -@TypeSpec.Versioning.useDependency(AzureHealthInsights.ApiVersion.v2023_03_01_preview) +@TypeSpec.Versioning.useDependency( + AzureHealthInsights.ApiVersion.v2023_03_01_preview +) namespace ClientForAzureHealthInsights; - + @client({ - name: "ClinicalMatchingClient", - service: AzureHealthInsights + name: "ClinicalMatchingClient", + service: AzureHealthInsights, }) - interface ClinicalMatchingClient { - #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "https://github.com/microsoft/typespec/issues/2037" - matchTrials is AzureHealthInsights.TrialMatcher.createJob; +interface ClinicalMatchingClient { + #suppress "@azure-tools/typespec-azure-core/use-standard-operations" "https://github.com/microsoft/typespec/issues/2037" + matchTrials is AzureHealthInsights.TrialMatcher.createJob; } diff --git a/specification/cognitiveservices/HealthInsights/healthinsights.trialmatcher/model.trialmatcher.tsp b/specification/cognitiveservices/HealthInsights/healthinsights.trialmatcher/model.trialmatcher.tsp index 0c9b85ac3624..00827dd71ff5 100644 --- a/specification/cognitiveservices/HealthInsights/healthinsights.trialmatcher/model.trialmatcher.tsp +++ b/specification/cognitiveservices/HealthInsights/healthinsights.trialmatcher/model.trialmatcher.tsp @@ -9,6 +9,7 @@ namespace AzureHealthInsights; @doc("The body of the Trial Matcher request.") model TrialMatcherData { ...Request; + @doc("Configuration affecting the Trial Matcher model's inference.") configuration?: TrialMatcherModelConfiguration; } @@ -16,6 +17,7 @@ model TrialMatcherData { @doc("Configuration affecting the Trial Matcher model's inference.") model TrialMatcherModelConfiguration { ...ModelConfiguration; + @doc(""" The clinical trials that the patient(s) should be matched to.
The trial selection can be given as a list of custom clinical trials and/or a list of @@ -81,7 +83,6 @@ The bio-medical category related to the coded concept, e.g. Diagnosis, Symptom, category?: string; } - @doc("An inference made by the Trial Matcher model regarding a patient.") model TrialMatcherInference { @doc("The type of the Trial Matcher inference.") @@ -335,7 +336,7 @@ model ClinicalTrialResearchFacility { enum ClinicalTrialAcceptedSex { All: "all", Female: "female", - Male: "male" + Male: "male", } #suppress "@azure-tools/typespec-azure-core/documentation-required" "MUST fix in next update" diff --git a/specification/cognitiveservices/HealthInsights/service.tsp b/specification/cognitiveservices/HealthInsights/service.tsp index dc171a7c19b3..1df0a2e8cece 100644 --- a/specification/cognitiveservices/HealthInsights/service.tsp +++ b/specification/cognitiveservices/HealthInsights/service.tsp @@ -1,10 +1,10 @@ - using TypeSpec.Rest; using TypeSpec.Http; using TypeSpec.Versioning; - -@service({title: "Azure Health Insights"}) +@service({ + title: "Azure Health Insights", +}) @versioned(ApiVersion) @doc("Azure Health Insights provides an API that serves insight models, specific for Health & Life Sciences, that perform analysis and provide inferences to be used by a human.") @server( @@ -15,13 +15,10 @@ using TypeSpec.Versioning; endpoint: url, } ) - @useAuth(ApiKeyAuth) - namespace AzureHealthInsights; #suppress "@azure-tools/typespec-azure-core/documentation-required" "https://github.com/Azure/typespec-azure/issues/3107" enum ApiVersion { - v2023_03_01_preview: "2023-03-01-preview" + v2023_03_01_preview: "2023-03-01-preview", } - diff --git a/specification/cognitiveservices/OpenAI.Inference/main.tsp b/specification/cognitiveservices/OpenAI.Inference/main.tsp index 406a34f2b940..907df85b7483 100644 --- a/specification/cognitiveservices/OpenAI.Inference/main.tsp +++ b/specification/cognitiveservices/OpenAI.Inference/main.tsp @@ -10,16 +10,17 @@ using TypeSpec.Versioning; #suppress "@azure-tools/typespec-azure-core/casing-style" "OpenAI is a case-sensitive name" @useAuth( - ApiKeyAuth | - OAuth2Auth<[{ + ApiKeyAuth | OAuth2Auth<[ + { type: OAuth2FlowType.implicit, authorizationUrl: "https://login.microsoftonline.com/common/oauth2/v2.0/authorize", - scopes: ["https://cognitiveservices.azure.com/.default"] - }]>) -@service( - { - title: "Azure OpenAI API" - }) + scopes: ["https://cognitiveservices.azure.com/.default"], + } + ]> +) +@service({ + title: "Azure OpenAI API", +}) @server( "{endpoint}/openai", "Azure OpenAI APIs for completions and search", @@ -39,6 +40,7 @@ namespace Azure.OpenAI; enum ServiceApiVersions { @useDependency(Azure.Core.Versions.v1_0_Preview_1) v2022_12_01: "2022-12-01", + @useDependency(Azure.Core.Versions.v1_0_Preview_1) v2023_03_15_Preview: "2023-03-15-preview", } diff --git a/specification/cognitiveservices/OpenAI.Inference/models/chat.completions.tsp b/specification/cognitiveservices/OpenAI.Inference/models/chat.completions.tsp index 9a1fe0deaf80..ac602828aab9 100644 --- a/specification/cognitiveservices/OpenAI.Inference/models/chat.completions.tsp +++ b/specification/cognitiveservices/OpenAI.Inference/models/chat.completions.tsp @@ -7,28 +7,28 @@ using TypeSpec.Http; @doc("A description of the intended purpose of a message within a chat completions interaction.") enum ChatRole { - @doc("The role that instructs or sets the behavior of the assistant.") - @projectedName("json", "system") - system, + @doc("The role that instructs or sets the behavior of the assistant.") + @projectedName("json", "system") + system, - @doc("The role that provides responses to system-instructed, user-prompted input.") - @projectedName("json", "assistant") - assistant, + @doc("The role that provides responses to system-instructed, user-prompted input.") + @projectedName("json", "assistant") + assistant, - @doc("The role that provides input for chat completions.") - @projectedName("json", "user") - user, + @doc("The role that provides input for chat completions.") + @projectedName("json", "user") + user, } @doc("A single, role-attributed message within a chat completion interaction.") model ChatMessage { - @doc("The role associated with this message payload.") - @projectedName("json", "role") - role: ChatRole; + @doc("The role associated with this message payload.") + @projectedName("json", "role") + role: ChatRole; - @doc("The text associated with this message payload.") - @projectedName("json", "content") - content?: string; + @doc("The text associated with this message payload.") + @projectedName("json", "content") + content?: string; } @doc(""" @@ -37,30 +37,30 @@ Completions support a wide variety of tasks and generate text that continues fro provided prompt data. """) model ChatCompletionsOptions { - @doc(""" + @doc(""" The collection of context messages associated with this chat completions request. Typical usage begins with a chat message for the System role that provides instructions for the behavior of the assistant, followed by alternating messages between the User and Assistant roles. """) - @projectedName("json", "messages") - messages: ChatMessage[]; + @projectedName("json", "messages") + messages: ChatMessage[]; - @doc("The maximum number of tokens to generate.") - @projectedName("json", "max_tokens") - maxTokens?: int32; + @doc("The maximum number of tokens to generate.") + @projectedName("json", "max_tokens") + maxTokens?: int32; - @doc(""" + @doc(""" The sampling temperature to use that controls the apparent creativity of generated completions. Higher values will make output more random while lower values will make results more focused and deterministic. It is not recommended to modify temperature and top_p for the same completions request as the interaction of these two settings is difficult to predict. """) - @projectedName("json", "temperature") - temperature?: float32; + @projectedName("json", "temperature") + temperature?: float32; - @doc(""" + @doc(""" An alternative to sampling with temperature called nucleus sampling. This value causes the model to consider the results of tokens with the provided probability mass. As an example, a value of 0.15 will cause only the tokens comprising the top 15% of probability mass to be @@ -68,78 +68,78 @@ model ChatCompletionsOptions { It is not recommended to modify temperature and top_p for the same completions request as the interaction of these two settings is difficult to predict. """) - @projectedName("json", "top_p") - @projectedName("csharp", "NucleusSamplingFactor") - topP?: float32; + @projectedName("json", "top_p") + @projectedName("csharp", "NucleusSamplingFactor") + topP?: float32; - @doc(""" + @doc(""" A map between GPT token IDs and bias scores that influences the probability of specific tokens appearing in a completions response. Token IDs are computed via external tokenizer tools, while bias scores reside in the range of -100 to 100 with minimum and maximum values corresponding to a full ban or exclusive selection of a token, respectively. The exact behavior of a given bias score varies by model. """) - @projectedName("json", "logit_bias") - @projectedName("csharp", "InternalStringKeyedTokenSelectionBiases") - logitBias?: Record; + @projectedName("json", "logit_bias") + @projectedName("csharp", "InternalStringKeyedTokenSelectionBiases") + logitBias?: Record; - @doc(""" + @doc(""" An identifier for the caller or end user of the operation. This may be used for tracking or rate-limiting purposes. """) - @projectedName("json", "user") - user?: string; + @projectedName("json", "user") + user?: string; - @doc(""" + @doc(""" The number of chat completions choices that should be generated for a chat completions response. Because this setting can generate many completions, it may quickly consume your token quota. Use carefully and ensure reasonable settings for max_tokens and stop. """) - @projectedName("json", "n") - @projectedName("csharp", "ChoiceCount") - n?: int32; + @projectedName("json", "n") + @projectedName("csharp", "ChoiceCount") + n?: int32; - @doc(""" + @doc(""" A collection of textual sequences that will end completions generation. """) - @projectedName("json", "stop") - @projectedName("csharp", "StopSequences") - stop?: string[]; + @projectedName("json", "stop") + @projectedName("csharp", "StopSequences") + stop?: string[]; - @doc(""" + @doc(""" A value that influences the probability of generated tokens appearing based on their existing presence in generated text. Positive values will make tokens less likely to appear when they already exist and increase the model's likelihood to output new topics. """) - @projectedName("json", "presence_penalty") - presencePenalty?: float32; + @projectedName("json", "presence_penalty") + presencePenalty?: float32; - @doc(""" + @doc(""" A value that influences the probability of generated tokens appearing based on their cumulative frequency in generated text. Positive values will make tokens less likely to appear as their frequency increases and decrease the likelihood of the model repeating the same statements verbatim. """) - @projectedName("json", "frequency_penalty") - frequencyPenalty?: float32; + @projectedName("json", "frequency_penalty") + frequencyPenalty?: float32; - @doc(""" + @doc(""" A value indicating whether chat completions should be streamed for this request. """) - @projectedName("json", "stream") - @projectedName("csharp", "InternalShouldStreamResponse") - stream?: boolean; + @projectedName("json", "stream") + @projectedName("csharp", "InternalShouldStreamResponse") + stream?: boolean; - @doc(""" + @doc(""" The model name to provide as part of this completions request. Not applicable to Azure OpenAI, where deployment information should be included in the Azure resource URI that's connected to. """) - @projectedName("json", "model") - @projectedName("csharp", "InternalNonAzureModelName") - `model`?: string; + @projectedName("json", "model") + @projectedName("csharp", "InternalNonAzureModelName") + `model`?: string; } @doc(""" @@ -148,23 +148,23 @@ Generally, `n` choices are generated per provided prompt with a default value of Token limits and other settings may limit the number of choices generated. """) model ChatChoice { - @doc("The chat message for a given chat completions prompt.") - @projectedName("json", "message") - message?: ChatMessage; - - @doc("The ordered index associated with this chat completions choice.") - @projectedName("json", "index") - index: int32; - - #suppress "@azure-tools/typespec-azure-core/no-nullable" "The operation already returns nulls" - @doc("The reason that this chat completions choice completed its generated.") - @projectedName("json", "finish_reason") - finishReason: CompletionsFinishReason | null; - - @doc("The delta message content for a streaming response.") - @projectedName("json", "delta") - @projectedName("csharp", "InternalStreamingDeltaMessage") - delta?: ChatMessage; + @doc("The chat message for a given chat completions prompt.") + @projectedName("json", "message") + message?: ChatMessage; + + @doc("The ordered index associated with this chat completions choice.") + @projectedName("json", "index") + index: int32; + + #suppress "@azure-tools/typespec-azure-core/no-nullable" "The operation already returns nulls" + @doc("The reason that this chat completions choice completed its generated.") + @projectedName("json", "finish_reason") + finishReason: CompletionsFinishReason | null; + + @doc("The delta message content for a streaming response.") + @projectedName("json", "delta") + @projectedName("csharp", "InternalStreamingDeltaMessage") + delta?: ChatMessage; } @doc(""" @@ -173,29 +173,29 @@ Completions support a wide variety of tasks and generate text that continues fro provided prompt data. """) model ChatCompletions { - @doc("A unique identifier associated with this chat completions response.") - @projectedName("json", "id") - id: string; + @doc("A unique identifier associated with this chat completions response.") + @projectedName("json", "id") + id: string; - @doc(""" + @doc(""" The first timestamp associated with generation activity for this completions response, represented as seconds since the beginning of the Unix epoch of 00:00 on 1 Jan 1970. """) - @projectedName("json", "created") - @projectedName("csharp", "InternalCreatedSecondsAfterUnixEpoch") - created: int32; + @projectedName("json", "created") + @projectedName("csharp", "InternalCreatedSecondsAfterUnixEpoch") + created: int32; - @doc(""" + @doc(""" The collection of completions choices associated with this completions response. Generally, `n` choices are generated per provided prompt with a default value of 1. Token limits and other settings may limit the number of choices generated. """) - @projectedName("json", "choices") - choices: ChatChoice[]; + @projectedName("json", "choices") + choices: ChatChoice[]; - @doc(""" + @doc(""" Usage information for tokens processed and generated as part of this completions operation. """) - @projectedName("json", "usage") - usage: CompletionsUsage; + @projectedName("json", "usage") + usage: CompletionsUsage; } diff --git a/specification/cognitiveservices/OpenAI.Inference/models/completions.common.tsp b/specification/cognitiveservices/OpenAI.Inference/models/completions.common.tsp index f7c65536d9b0..41b3ab740b2f 100644 --- a/specification/cognitiveservices/OpenAI.Inference/models/completions.common.tsp +++ b/specification/cognitiveservices/OpenAI.Inference/models/completions.common.tsp @@ -4,33 +4,35 @@ Counts consider all tokens across prompts, choices, choice alternates, best_of g other consumers. """) model CompletionsUsage { - @doc("The number of tokens generated across all completions emissions.") - @projectedName("json", "completion_tokens") - completionTokens: int32, - @doc("The number of tokens in the provided prompts for the completions request.") - @projectedName("json", "prompt_tokens") - promptTokens: int32, - @doc("The total number of tokens processed for the completions request and response.") - @projectedName("json", "total_tokens") - totalTokens: int32 + @doc("The number of tokens generated across all completions emissions.") + @projectedName("json", "completion_tokens") + completionTokens: int32; + + @doc("The number of tokens in the provided prompts for the completions request.") + @projectedName("json", "prompt_tokens") + promptTokens: int32; + + @doc("The total number of tokens processed for the completions request and response.") + @projectedName("json", "total_tokens") + totalTokens: int32; } @doc(""" Representation of the manner in which a completions response concluded. """) enum CompletionsFinishReason { - @doc("Completions ended normally and reached its end of token generation.") - @projectedName("json", "stop") - stopped, + @doc("Completions ended normally and reached its end of token generation.") + @projectedName("json", "stop") + stopped, - @doc("Completions exhausted available token limits before generation could complete.") - @projectedName("json", "length") - tokenLimitReached, + @doc("Completions exhausted available token limits before generation could complete.") + @projectedName("json", "length") + tokenLimitReached, - @doc(""" + @doc(""" Completions generated a response that was identified as potentially sensitive per content moderation policies. """) - @projectedName("json", "content_filter") - contentFiltered -} \ No newline at end of file + @projectedName("json", "content_filter") + contentFiltered, +} diff --git a/specification/cognitiveservices/OpenAI.Inference/models/completions.create.tsp b/specification/cognitiveservices/OpenAI.Inference/models/completions.create.tsp index ba8029c152c3..c9dd466055ae 100644 --- a/specification/cognitiveservices/OpenAI.Inference/models/completions.create.tsp +++ b/specification/cognitiveservices/OpenAI.Inference/models/completions.create.tsp @@ -11,26 +11,26 @@ Completions support a wide variety of tasks and generate text that continues fro provided prompt data. """) model CompletionsOptions { - @doc("The prompts to generate completions from.") - @projectedName("json", "prompt") - @projectedName("csharp", "Prompts") - prompt: string[]; + @doc("The prompts to generate completions from.") + @projectedName("json", "prompt") + @projectedName("csharp", "Prompts") + prompt: string[]; - @doc("The maximum number of tokens to generate.") - @projectedName("json", "max_tokens") - maxTokens?: int32; + @doc("The maximum number of tokens to generate.") + @projectedName("json", "max_tokens") + maxTokens?: int32; - @doc(""" + @doc(""" The sampling temperature to use that controls the apparent creativity of generated completions. Higher values will make output more random while lower values will make results more focused and deterministic. It is not recommended to modify temperature and top_p for the same completions request as the interaction of these two settings is difficult to predict. """) - @projectedName("json", "temperature") - temperature?: float32; + @projectedName("json", "temperature") + temperature?: float32; - @doc(""" + @doc(""" An alternative to sampling with temperature called nucleus sampling. This value causes the model to consider the results of tokens with the provided probability mass. As an example, a value of 0.15 will cause only the tokens comprising the top 15% of probability mass to be @@ -38,79 +38,79 @@ model CompletionsOptions { It is not recommended to modify temperature and top_p for the same completions request as the interaction of these two settings is difficult to predict. """) - @projectedName("json", "top_p") - @projectedName("csharp", "NucleusSamplingFactor") - topP?: float32; + @projectedName("json", "top_p") + @projectedName("csharp", "NucleusSamplingFactor") + topP?: float32; - @doc(""" + @doc(""" A map between GPT token IDs and bias scores that influences the probability of specific tokens appearing in a completions response. Token IDs are computed via external tokenizer tools, while bias scores reside in the range of -100 to 100 with minimum and maximum values corresponding to a full ban or exclusive selection of a token, respectively. The exact behavior of a given bias score varies by model. """) - @projectedName("json", "logit_bias") - @projectedName("csharp", "InternalStringKeyedTokenSelectionBiases") - logitBias?: Record; + @projectedName("json", "logit_bias") + @projectedName("csharp", "InternalStringKeyedTokenSelectionBiases") + logitBias?: Record; - @doc(""" + @doc(""" An identifier for the caller or end user of the operation. This may be used for tracking or rate-limiting purposes. """) - @projectedName("json", "user") - user?: string; + @projectedName("json", "user") + user?: string; - @doc(""" + @doc(""" The number of completions choices that should be generated per provided prompt as part of an overall completions response. Because this setting can generate many completions, it may quickly consume your token quota. Use carefully and ensure reasonable settings for max_tokens and stop. """) - @projectedName("json", "n") - @projectedName("csharp", "ChoicesPerPrompt") - n?: int32; + @projectedName("json", "n") + @projectedName("csharp", "ChoicesPerPrompt") + n?: int32; - @doc(""" + @doc(""" A value that controls the emission of log probabilities for the provided number of most likely tokens within a completions response. """) - @projectedName("json", "logprobs") - @projectedName("csharp", "LogProbabilityCount") - logprobs?: int32; + @projectedName("json", "logprobs") + @projectedName("csharp", "LogProbabilityCount") + logprobs?: int32; - @doc(""" + @doc(""" A value specifying whether completions responses should include input prompts as prefixes to their generated output. """) - @projectedName("json", "echo") - echo?: boolean; + @projectedName("json", "echo") + echo?: boolean; - @doc(""" + @doc(""" A collection of textual sequences that will end completions generation. """) - @projectedName("json", "stop") - @projectedName("csharp", "StopSequences") - stop?: string[]; + @projectedName("json", "stop") + @projectedName("csharp", "StopSequences") + stop?: string[]; - @doc(""" + @doc(""" A value that influences the probability of generated tokens appearing based on their existing presence in generated text. Positive values will make tokens less likely to appear when they already exist and increase the model's likelihood to output new topics. """) - @projectedName("json", "presence_penalty") - presencePenalty?: float32; + @projectedName("json", "presence_penalty") + presencePenalty?: float32; - @doc(""" + @doc(""" A value that influences the probability of generated tokens appearing based on their cumulative frequency in generated text. Positive values will make tokens less likely to appear as their frequency increases and decrease the likelihood of the model repeating the same statements verbatim. """) - @projectedName("json", "frequency_penalty") - frequencyPenalty?: float32; + @projectedName("json", "frequency_penalty") + frequencyPenalty?: float32; - @doc(""" + @doc(""" A value that controls how many completions will be internally generated prior to response formulation. When used together with n, best_of controls the number of candidate completions and must be @@ -118,25 +118,25 @@ model CompletionsOptions { Because this setting can generate many completions, it may quickly consume your token quota. Use carefully and ensure reasonable settings for max_tokens and stop. """) - @projectedName("json", "best_of") - @projectedName("csharp", "GenerationSampleCount") - bestOf?: int32; + @projectedName("json", "best_of") + @projectedName("csharp", "GenerationSampleCount") + bestOf?: int32; - @doc(""" + @doc(""" A value indicating whether chat completions should be streamed for this request. """) - @projectedName("json", "stream") - @projectedName("csharp", "InternalShouldStreamResponse") - stream?: boolean; + @projectedName("json", "stream") + @projectedName("csharp", "InternalShouldStreamResponse") + stream?: boolean; - @doc(""" + @doc(""" The model name to provide as part of this completions request. Not applicable to Azure OpenAI, where deployment information should be included in the Azure resource URI that's connected to. """) - @projectedName("json", "model") - @projectedName("csharp", "InternalNonAzureModelName") - `model`?: string; + @projectedName("json", "model") + @projectedName("csharp", "InternalNonAzureModelName") + `model`?: string; } @doc(""" @@ -145,31 +145,31 @@ Completions support a wide variety of tasks and generate text that continues fro provided prompt data. """) model Completions { - @doc("A unique identifier associated with this completions response.") - @projectedName("json", "id") - id: string; + @doc("A unique identifier associated with this completions response.") + @projectedName("json", "id") + id: string; - @doc(""" + @doc(""" The first timestamp associated with generation activity for this completions response, represented as seconds since the beginning of the Unix epoch of 00:00 on 1 Jan 1970. """) - @projectedName("json", "created") - @projectedName("csharp", "InternalCreatedSecondsAfterUnixEpoch") - created: int32; + @projectedName("json", "created") + @projectedName("csharp", "InternalCreatedSecondsAfterUnixEpoch") + created: int32; - @doc(""" + @doc(""" The collection of completions choices associated with this completions response. Generally, `n` choices are generated per provided prompt with a default value of 1. Token limits and other settings may limit the number of choices generated. """) - @projectedName("json", "choices") - choices: Choice[]; + @projectedName("json", "choices") + choices: Choice[]; - @doc(""" + @doc(""" Usage information for tokens processed and generated as part of this completions operation. """) - @projectedName("json", "usage") - usage: CompletionsUsage; + @projectedName("json", "usage") + usage: CompletionsUsage; } @doc(""" @@ -178,24 +178,24 @@ Generally, `n` choices are generated per provided prompt with a default value of Token limits and other settings may limit the number of choices generated. """) model Choice { - @doc("The generated text for a given completions prompt.") - @projectedName("json", "text") - text: string; - - @doc("The ordered index associated with this completions choice.") - @projectedName("json", "index") - index: int32; - - #suppress "@azure-tools/typespec-azure-core/no-nullable" "The operation already returns nulls" - @doc("The log probabilities model for tokens associated with this completions choice.") - @projectedName("json", "logprobs") - @projectedName("csharp", "LogProbabilityModel") - logprobs: CompletionsLogProbabilityModel | null; - - #suppress "@azure-tools/typespec-azure-core/no-nullable" "The operation already returns nulls" - @doc("Reason for finishing") - @projectedName("json", "finish_reason") - finishReason: CompletionsFinishReason | null; + @doc("The generated text for a given completions prompt.") + @projectedName("json", "text") + text: string; + + @doc("The ordered index associated with this completions choice.") + @projectedName("json", "index") + index: int32; + + #suppress "@azure-tools/typespec-azure-core/no-nullable" "The operation already returns nulls" + @doc("The log probabilities model for tokens associated with this completions choice.") + @projectedName("json", "logprobs") + @projectedName("csharp", "LogProbabilityModel") + logprobs: CompletionsLogProbabilityModel | null; + + #suppress "@azure-tools/typespec-azure-core/no-nullable" "The operation already returns nulls" + @doc("Reason for finishing") + @projectedName("json", "finish_reason") + finishReason: CompletionsFinishReason | null; } alias NullableFloat = float32 | null; @@ -204,22 +204,22 @@ alias NullableFloat = float32 | null; Representation of a log probabilities model for a completions generation. """) model CompletionsLogProbabilityModel { - @doc("The textual forms of tokens evaluated in this probability model.") - @projectedName("json", "tokens") - tokens: string[]; - - @doc("A collection of log probability values for the tokens in this completions data.") - @projectedName("json", "token_logprobs") - @projectedName("csharp", "TokenLogProbabilities") - tokenLogprobs: NullableFloat[]; - - @doc("A mapping of tokens to maximum log probability values in this completions data.") - @projectedName("json", "top_logprobs") - @projectedName("csharp", "TopLogProbabilities") - topLogprobs: Record[]; - - @doc("The text offsets associated with tokens in this completions data.") - @projectedName("json", "text_offset") - @projectedName("csharp", "TextOffsets") - textOffset: int32[]; + @doc("The textual forms of tokens evaluated in this probability model.") + @projectedName("json", "tokens") + tokens: string[]; + + @doc("A collection of log probability values for the tokens in this completions data.") + @projectedName("json", "token_logprobs") + @projectedName("csharp", "TokenLogProbabilities") + tokenLogprobs: NullableFloat[]; + + @doc("A mapping of tokens to maximum log probability values in this completions data.") + @projectedName("json", "top_logprobs") + @projectedName("csharp", "TopLogProbabilities") + topLogprobs: Record[]; + + @doc("The text offsets associated with tokens in this completions data.") + @projectedName("json", "text_offset") + @projectedName("csharp", "TextOffsets") + textOffset: int32[]; } diff --git a/specification/cognitiveservices/OpenAI.Inference/models/embeddings.create.tsp b/specification/cognitiveservices/OpenAI.Inference/models/embeddings.create.tsp index 2ed1da7468b2..f80455c67866 100644 --- a/specification/cognitiveservices/OpenAI.Inference/models/embeddings.create.tsp +++ b/specification/cognitiveservices/OpenAI.Inference/models/embeddings.create.tsp @@ -10,31 +10,31 @@ Embeddings measure the relatedness of text strings and are commonly used for sea recommendations, and other similar scenarios. """) model EmbeddingsOptions { - @doc(""" + @doc(""" An identifier for the caller or end user of the operation. This may be used for tracking or rate-limiting purposes. """) - @projectedName("json", "user") - user?: string; + @projectedName("json", "user") + user?: string; - @doc(""" + @doc(""" The model name to provide as part of this embeddings request. Not applicable to Azure OpenAI, where deployment information should be included in the Azure resource URI that's connected to. """) - @projectedName("json", "model") - @projectedName("csharp", "InternalNonAzureModelName") - "model"?: string; + @projectedName("json", "model") + @projectedName("csharp", "InternalNonAzureModelName") + `model`?: string; - @doc(""" + @doc(""" Input texts to get embeddings for, encoded as a an array of strings. Each input must not exceed 2048 tokens in length. Unless you are embedding code, we suggest replacing newlines (\\n) in your input with a single space, as we have observed inferior results when newlines are present. """) - input: string[]; -}; + input: string[]; +} @doc(""" Representation of the response data from an embeddings request. @@ -42,32 +42,32 @@ Embeddings measure the relatedness of text strings and are commonly used for sea recommendations, and other similar scenarios. """) model Embeddings { - @doc("Embedding values for the prompts submitted in the request.") - data: EmbeddingItem[], + @doc("Embedding values for the prompts submitted in the request.") + data: EmbeddingItem[]; - @doc("Usage counts for tokens input using the embeddings API.") - usage: EmbeddingsUsage; + @doc("Usage counts for tokens input using the embeddings API.") + usage: EmbeddingsUsage; } @doc("Representation of a single embeddings relatedness comparison.") model EmbeddingItem { - @doc(""" + @doc(""" List of embeddings value for the input prompt. These represent a measurement of the vector-based relatedness of the provided input. """) - embedding: float32[]; + embedding: float32[]; - @doc("Index of the prompt to which the EmbeddingItem corresponds.") - index: int32; + @doc("Index of the prompt to which the EmbeddingItem corresponds.") + index: int32; } @doc("Measurement of the amount of tokens used in this request and response.") model EmbeddingsUsage { - @doc("Number of tokens sent in the original request.") - @projectedName("json", "prompt_tokens") - promptTokens: int32, + @doc("Number of tokens sent in the original request.") + @projectedName("json", "prompt_tokens") + promptTokens: int32; - @doc("Total number of tokens transacted in this request/response.") - @projectedName("json", "total_tokens") - totalTokens: int32 -} \ No newline at end of file + @doc("Total number of tokens transacted in this request/response.") + @projectedName("json", "total_tokens") + totalTokens: int32; +} diff --git a/specification/cognitiveservices/OpenAI.Inference/routes.tsp b/specification/cognitiveservices/OpenAI.Inference/routes.tsp index 5c2cb74af0e3..671e5b505609 100644 --- a/specification/cognitiveservices/OpenAI.Inference/routes.tsp +++ b/specification/cognitiveservices/OpenAI.Inference/routes.tsp @@ -18,9 +18,9 @@ namespace Azure.OpenAI; @TypeSpec.Rest.actionSeparator("/") @action("embeddings") //@convenientAPI(true) op getEmbeddings is Azure.Core.ResourceAction< - Deployment, - EmbeddingsOptions, - Embeddings + Deployment, + EmbeddingsOptions, + Embeddings >; @doc(""" @@ -31,9 +31,9 @@ provided prompt data. @TypeSpec.Rest.actionSeparator("/") @action("completions") //@convenientAPI(true) op getCompletions is Azure.Core.ResourceAction< - Deployment, - CompletionsOptions, - Completions + Deployment, + CompletionsOptions, + Completions >; @doc(""" @@ -44,7 +44,7 @@ provided prompt data. @TypeSpec.Rest.actionSeparator("/") @action("chat/completions") //@convenientAPI(true) op getChatCompletions is Azure.Core.ResourceAction< - Deployment, - ChatCompletionsOptions, - ChatCompletions + Deployment, + ChatCompletionsOptions, + ChatCompletions >; diff --git a/specification/containerservice/Fleet.Management/fleetmember.tsp b/specification/containerservice/Fleet.Management/fleetmember.tsp index 2cb27947d327..94793fef2fce 100644 --- a/specification/containerservice/Fleet.Management/fleetmember.tsp +++ b/specification/containerservice/Fleet.Management/fleetmember.tsp @@ -78,13 +78,16 @@ interface FleetMembers { >; @added(Versions.v2023_03_15_preview) - update is ArmResourcePatchSync & - IfMatchParameters>; + update is ArmResourcePatchSync< + FleetMember, + FleetMemberProperties, + BaseParameters & IfMatchParameters + >; @extension( "x-ms-long-running-operation-options", { - "final-state-via": "location", + `final-state-via`: "location", } ) delete is ArmResourceDeleteAsync< diff --git a/specification/containerservice/Fleet.Management/helpers.tsp b/specification/containerservice/Fleet.Management/helpers.tsp index 976c759d231e..7b35d2cbe420 100644 --- a/specification/containerservice/Fleet.Management/helpers.tsp +++ b/specification/containerservice/Fleet.Management/helpers.tsp @@ -29,8 +29,9 @@ alias IfMatchHeadersParameters; }; -#suppress "@azure-tools/typespec-providerhub/no-inline-model" "inlining the response with a header does not present a risk" -alias ArmAcceptedResponseWithLocationHeader = ArmAcceptedResponse & LocationHeader; +#suppress "@azure-tools/typespec-providerhub/no-inline-model" "inlining the response with a header does not present a risk" +alias ArmAcceptedResponseWithLocationHeader = ArmAcceptedResponse & + LocationHeader; #suppress "@azure-tools/typespec-azure-core/documentation-required" "this is a template" #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation-outside-interface" "this is a template" @@ -44,7 +45,6 @@ op ArmResourceNoRequestBodyActionSync< ...ResourceInstanceParameters ): ArmResponse | ErrorResponse; - #suppress "@azure-tools/typespec-azure-core/documentation-required" "this is a template" #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation-outside-interface" "this is a template" @armResourceAction(TResource) @@ -52,7 +52,7 @@ op ArmResourceNoRequestBodyActionSync< @extension( "x-ms-long-running-operation-options", { - "final-state-via": "location", + `final-state-via`: "location", } ) @post @@ -81,7 +81,6 @@ op FleetCustomPatchSync< parameters?: TPatchModel //prevents api breaking change. properties -> parameters ): ArmResponse | ErrorResponse; - #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation-outside-interface" "this is a template" @autoRoute @doc("Create a {name}", TResource) @@ -89,7 +88,7 @@ op FleetCustomPatchSync< @extension( "x-ms-long-running-operation-options", { - "final-state-via": "azure-async-operation", + `final-state-via`: "azure-async-operation", } ) @armResourceCreateOrUpdate(TResource) @@ -105,10 +104,9 @@ op FleetArmResourceCreateOrUpdateAsync< parameters: TResource //prevent api breaking change. resource -> parameters ): ArmResponse | ArmCreatedResponse | ErrorResponse; - // this is a copy of ArmResourceDeleteAsync that adds the location header to comply with arm linter. #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation-outside-interface" "this is a template" -#suppress "@azure-tools/typespec-providerhub/no-inline-model" "inlining the response with a header does not present a risk" +#suppress "@azure-tools/typespec-providerhub/no-inline-model" "inlining the response with a header does not present a risk" @autoRoute @doc("Delete a {name}", TResource) @extension("x-ms-long-running-operation", true) @@ -125,6 +123,6 @@ op FleetArmResourceDeleteAsync< TBaseParameters = BaseParameters >(...ResourceInstanceParameters): | ArmDeletedResponse - | ArmDeleteAcceptedResponse & LocationHeader + | (ArmDeleteAcceptedResponse & LocationHeader) | ArmDeletedNoContentResponse | ErrorResponse; diff --git a/specification/containerservice/Fleet.Management/main.tsp b/specification/containerservice/Fleet.Management/main.tsp index 71a809442dc9..67948fac613b 100644 --- a/specification/containerservice/Fleet.Management/main.tsp +++ b/specification/containerservice/Fleet.Management/main.tsp @@ -26,5 +26,5 @@ enum Versions { @useDependency(Azure.Core.Versions.v1_0_Preview_2) @useDependency(Azure.ResourceManager.Versions.v1_0_Preview_1) - v2023_03_15_preview: "2023-03-15-preview" + v2023_03_15_preview: "2023-03-15-preview", } diff --git a/specification/containerservice/Fleet.Management/updaterun.tsp b/specification/containerservice/Fleet.Management/updaterun.tsp index 5f019a1c934d..343e6c45a66b 100644 --- a/specification/containerservice/Fleet.Management/updaterun.tsp +++ b/specification/containerservice/Fleet.Management/updaterun.tsp @@ -21,49 +21,49 @@ namespace Microsoft.ContainerService; @parentResource(Fleet) @doc("An UpdateRun is a multi-stage process to perform update operations across members of a Fleet.") model UpdateRun is ProxyResource { - @doc("The name of the UpdateRun resource.") - @key("updateRunName") - @segment("updateRuns") - @pattern("^[a-z0-9]([-a-z0-9]*[a-z0-9])?$") - @minLength(1) - @maxLength(50) - @path - @visibility("create", "read") - name: string; - ...EntityTag; + @doc("The name of the UpdateRun resource.") + @key("updateRunName") + @segment("updateRuns") + @pattern("^[a-z0-9]([-a-z0-9]*[a-z0-9])?$") + @minLength(1) + @maxLength(50) + @path + @visibility("create", "read") + name: string; + ...EntityTag; } @doc("The provisioning state of the UpdateRun resource.") enum UpdateRunProvisioningState { - ...ResourceProvisioningState + ...ResourceProvisioningState, } @doc("The properties of the UpdateRun.") model UpdateRunProperties { - @visibility("read") - @doc("The provisioning state of the UpdateRun resource.") - provisioningState?: UpdateRunProvisioningState; + @visibility("read") + @doc("The provisioning state of the UpdateRun resource.") + provisioningState?: UpdateRunProvisioningState; - @doc(""" + @doc(""" The strategy defines the order in which the clusters will be updated. If not set, all members will be updated sequentially. The UpdateRun status will show a single UpdateStage and a single UpdateGroup targeting all members. The strategy of the UpdateRun can be modified until the run is started. """) - strategy?: UpdateRunStrategy; + strategy?: UpdateRunStrategy; - @doc("The update to be applied to all clusters in the UpdateRun. The managedClusterUpdate can be modified until the run is started.") - managedClusterUpdate: ManagedClusterUpdate; + @doc("The update to be applied to all clusters in the UpdateRun. The managedClusterUpdate can be modified until the run is started.") + managedClusterUpdate: ManagedClusterUpdate; - @visibility("read") - @doc("The status of the UpdateRun.") - status?: UpdateRunStatus; + @visibility("read") + @doc("The status of the UpdateRun.") + status?: UpdateRunStatus; } @doc("The UpdateRunStrategy configures the sequence of Stages and Groups in which the clusters will be updated.") model UpdateRunStrategy { - @extension("x-ms-identifiers",["name"]) + @extension("x-ms-identifiers", ["name"]) @doc("The list of stages that compose this update run.") - stages:UpdateStage[]; + stages: UpdateStage[]; } @doc(""" @@ -74,174 +74,173 @@ Update order: - Sequential within a group: Clusters within a group are updated sequentially. """) model UpdateStage { - @doc("The name of the stage. Must be unique within the UpdateRun.") - @pattern("^[a-z0-9]([-a-z0-9]*[a-z0-9])?$") - @minLength(1) - @maxLength(50) - name: string; - - @extension("x-ms-identifiers",["name"]) - @doc(""" + @doc("The name of the stage. Must be unique within the UpdateRun.") + @pattern("^[a-z0-9]([-a-z0-9]*[a-z0-9])?$") + @minLength(1) + @maxLength(50) + name: string; + + @extension("x-ms-identifiers", ["name"]) + @doc(""" A list of group names that compose the stage. The groups will be updated in parallel. Each group name can only appear once in the UpdateRun. """) - groups?: UpdateGroup[]; + groups?: UpdateGroup[]; - @doc("The time in seconds to wait at the end of this stage before starting the next one. Defaults to 0 seconds if unspecified.") - afterStageWaitInSeconds?: int32; + @doc("The time in seconds to wait at the end of this stage before starting the next one. Defaults to 0 seconds if unspecified.") + afterStageWaitInSeconds?: int32; } @doc("A group to be updated.") model UpdateGroup { - @doc(""" + @doc(""" The name of the Fleet member group to update. It should match the name of an existing FleetMember group. A group can only appear once across all UpdateStages in the UpdateRun. """) - @pattern("^[a-z0-9]([-a-z0-9]*[a-z0-9])?$") - @minLength(1) - @maxLength(50) - name: string + @pattern("^[a-z0-9]([-a-z0-9]*[a-z0-9])?$") + @minLength(1) + @maxLength(50) + name: string; } @doc("The update to be applied to the ManagedClusters.") model ManagedClusterUpdate { - @doc("The upgrade to apply to the ManagedClusters.") - upgrade: ManagedClusterUpgradeSpec; + @doc("The upgrade to apply to the ManagedClusters.") + upgrade: ManagedClusterUpgradeSpec; } scalar KubernetesVersion extends string; @doc("The upgrade to apply to a ManagedCluster.") model ManagedClusterUpgradeSpec { - @doc(""" + @doc(""" The upgrade type. Full requires the KubernetesVersion property to be set. NodeImageOnly requires the KubernetesVersion property not to be set. """) - type: ManagedClusterUpgradeType; + type: ManagedClusterUpgradeType; - @doc("The Kubernetes version to upgrade the member clusters to.") - kubernetesVersion?: KubernetesVersion; + @doc("The Kubernetes version to upgrade the member clusters to.") + kubernetesVersion?: KubernetesVersion; } - @doc("The type of upgrade to perform when targeting ManagedClusters.") -enum ManagedClusterUpgradeType{ - @doc("Full upgrades the control plane and all agent pools of the target ManagedClusters.") - Full, - @doc("NodeImageOnly upgrades only the node images of the target ManagedClusters.") - NodeImageOnly +enum ManagedClusterUpgradeType { + @doc("Full upgrades the control plane and all agent pools of the target ManagedClusters.") + Full, + + @doc("NodeImageOnly upgrades only the node images of the target ManagedClusters.") + NodeImageOnly, } #suppress "@azure-tools/typespec-azure-core/documentation-required" "MUST fix in next update" @doc("The state of the UpdateRun, UpdateStage, UpdateGroup, or MemberUpdate.") enum UpdateState { - NotStarted, - Running, - Stopping, - Stopped, - Failed, - Completed + NotStarted, + Running, + Stopping, + Stopped, + Failed, + Completed, } @doc("The status for an operation or group of operations.") model UpdateStatus { - @visibility("read") - @doc("The time the operation or group was started.") - startTime?: utcDateTime; - - @visibility("read") - @doc("The time the operation or group was completed.") - completedTime?: utcDateTime; - - @visibility("read") - @doc("The State of the operation or group.") - state?: UpdateState; - - @visibility("read") - @doc("The error details when a failure is encountered.") - error?: Azure.ResourceManager.Foundations.ErrorDetail // https://github.com/Azure/azure-rest-api-specs/blob/1de0b5315d62e1b40052bad2c9a2f2c89d84ff0f/specification/common-types/resource-management/v5/types.json#L260 + @visibility("read") + @doc("The time the operation or group was started.") + startTime?: utcDateTime; + + @visibility("read") + @doc("The time the operation or group was completed.") + completedTime?: utcDateTime; + + @visibility("read") + @doc("The State of the operation or group.") + state?: UpdateState; + + @visibility("read") + @doc("The error details when a failure is encountered.") + error?: Azure.ResourceManager.Foundations.ErrorDetail; // https://github.com/Azure/azure-rest-api-specs/blob/1de0b5315d62e1b40052bad2c9a2f2c89d84ff0f/specification/common-types/resource-management/v5/types.json#L260 } @doc("The status of a UpdateRun.") model UpdateRunStatus { - @visibility("read") - @doc("The status of the UpdateRun.") - status?: UpdateStatus; - - @visibility("read") - @extension("x-ms-identifiers",["name"]) - @doc("The stages composing an update run. Stages are run sequentially withing an UpdateRun.") - stages?: UpdateStageStatus[]; + @visibility("read") + @doc("The status of the UpdateRun.") + status?: UpdateStatus; + + @visibility("read") + @extension("x-ms-identifiers", ["name"]) + @doc("The stages composing an update run. Stages are run sequentially withing an UpdateRun.") + stages?: UpdateStageStatus[]; } @doc("The status of a UpdateStage.") model UpdateStageStatus { - @visibility("read") - @doc("The status of the UpdateStage.") - status?: UpdateStatus; - - @visibility("read") - @doc("The name of the UpdateStage.") - name?:string; - - @visibility("read") - @extension("x-ms-identifiers",["name"]) - @doc("The list of groups to be updated as part of this UpdateStage.") - groups?: UpdateGroupStatus[]; - - @visibility("read") - @doc("The status of the wait period configured on the UpdateStage.") - afterStageWaitStatus?: WaitStatus; + @visibility("read") + @doc("The status of the UpdateStage.") + status?: UpdateStatus; + + @visibility("read") + @doc("The name of the UpdateStage.") + name?: string; + + @visibility("read") + @extension("x-ms-identifiers", ["name"]) + @doc("The list of groups to be updated as part of this UpdateStage.") + groups?: UpdateGroupStatus[]; + + @visibility("read") + @doc("The status of the wait period configured on the UpdateStage.") + afterStageWaitStatus?: WaitStatus; } @doc("The status of a UpdateGroup.") model UpdateGroupStatus { - @visibility("read") - @doc("The status of the UpdateGroup.") - status?: UpdateStatus; - - @visibility("read") - @doc("The name of the UpdateGroup.") - name?:string; - - @visibility("read") - @extension("x-ms-identifiers",["name"]) - @doc("The list of member this UpdateGroup updates.") - members?: MemberUpdateStatus[]; + @visibility("read") + @doc("The status of the UpdateGroup.") + status?: UpdateStatus; + + @visibility("read") + @doc("The name of the UpdateGroup.") + name?: string; + + @visibility("read") + @extension("x-ms-identifiers", ["name"]) + @doc("The list of member this UpdateGroup updates.") + members?: MemberUpdateStatus[]; } @doc("The status of the wait duration.") model WaitStatus { - @visibility("read") - @doc("The status of the wait duration.") - status?: UpdateStatus; - - @visibility("read") - @doc("The wait duration configured in seconds.") - waitDurationInSeconds?: int32; + @visibility("read") + @doc("The status of the wait duration.") + status?: UpdateStatus; + + @visibility("read") + @doc("The wait duration configured in seconds.") + waitDurationInSeconds?: int32; } @doc("The status of a member update operation.") model MemberUpdateStatus { - @visibility("read") - @doc("The status of the MemberUpdate operation.") - status?: UpdateStatus; - - @visibility("read") - @doc("The name of the FleetMember.") - name?:string; - - @visibility("read") - @doc("The Azure resource id of the target Kubernetes cluster.") - clusterResourceId?:string; - - @visibility("read") - @doc("The operation resource id of the latest attempt to perform the operation.") - operationId?: string; -} + @visibility("read") + @doc("The status of the MemberUpdate operation.") + status?: UpdateStatus; + + @visibility("read") + @doc("The name of the FleetMember.") + name?: string; + @visibility("read") + @doc("The Azure resource id of the target Kubernetes cluster.") + clusterResourceId?: string; + + @visibility("read") + @doc("The operation resource id of the latest attempt to perform the operation.") + operationId?: string; +} @added(Versions.v2023_03_15_preview) @armResourceOperations @@ -258,7 +257,7 @@ interface UpdateRuns { @extension( "x-ms-long-running-operation-options", { - "final-state-via": "location", + `final-state-via`: "location", } ) delete is FleetArmResourceDeleteAsync< @@ -271,12 +270,14 @@ interface UpdateRuns { @doc("Starts an UpdateRun.") start is ArmResourceNoRequestBodyActionAsync< UpdateRun, - UpdateRun, BaseParameters & IfMatchParameters + UpdateRun, + BaseParameters & IfMatchParameters >; @doc("Stops an UpdateRun.") stop is ArmResourceNoRequestBodyActionAsync< UpdateRun, - UpdateRun, BaseParameters & IfMatchParameters + UpdateRun, + BaseParameters & IfMatchParameters >; -} \ No newline at end of file +} diff --git a/specification/contosowidgetmanager/Contoso.WidgetManager/main.tsp b/specification/contosowidgetmanager/Contoso.WidgetManager/main.tsp index 06b7b3e607c5..d72c0506ebdd 100644 --- a/specification/contosowidgetmanager/Contoso.WidgetManager/main.tsp +++ b/specification/contosowidgetmanager/Contoso.WidgetManager/main.tsp @@ -10,10 +10,9 @@ using TypeSpec.Versioning; using Azure.Core; @service({ - title: "Contoso Widget Manager", - }) + title: "Contoso Widget Manager", +}) @versioned(Contoso.WidgetManager.Versions) - namespace Azure.Contoso.WidgetManager; #suppress "@azure-tools/typespec-azure-core/documentation-required" "https://github.com/Azure/typespec-azure/issues/3107" diff --git a/specification/eventgrid/Azure.Messaging.EventGrid/main.tsp b/specification/eventgrid/Azure.Messaging.EventGrid/main.tsp index f8c3e64ae92f..b4efa9a5166d 100644 --- a/specification/eventgrid/Azure.Messaging.EventGrid/main.tsp +++ b/specification/eventgrid/Azure.Messaging.EventGrid/main.tsp @@ -3,10 +3,7 @@ import "@typespec/rest"; import "@typespec/versioning"; import "@azure-tools/typespec-azure-core"; -@useAuth( - ApiKeyAuth -) - +@useAuth(ApiKeyAuth) @service({ title: "Azure.Messaging.EventGridClient", }) @@ -19,8 +16,6 @@ import "@azure-tools/typespec-azure-core"; // POST https://{namespaceName}.{region}.eventgrid.azure.net/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:acknowledge?api-Version={apiVersion} // POST https://{namespaceName}.{region}.eventgrid.azure.net/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:release?api-version={apiVersion} // POST https://{namespaceName}.{region}.eventgrid.azure.net/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:reject?api-version={apiVersion} - - @server( "{endpoint}", "The host name of the namespace", @@ -29,10 +24,24 @@ import "@azure-tools/typespec-azure-core"; endpoint: url, } ) - @doc("Azure Messaging EventGrid Client") @versioned(ServiceApiVersions) namespace Azure.Messaging.EventGrid { + +// Publish Operation: +// POST https://{namespaceName}.{region}.eventgrid.azure.net/topics/{topicName}:publish?api-version={apiVersion}} + +// Receive Operation: +// POST https://{namespaceName}.{region}.eventgrid.azure.net/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:receive?api-Version={apiVersion}&maxWaitTime=60&maxEvents={maxEvents} + +// Acknowledge Operation: +// POST https://{namespaceName}.{region}.eventgrid.azure.net/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:acknowledge&apiVersion={apiVersion} + +// Release Operation: +// POST https://{namespaceName}.{region}.eventgrid.azure.net/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:release?api-version={apiVersion} + +// Reject Operation: +// POST https://{namespaceName}.{region}.eventgrid.azure.net/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:reject?api-version={apiVersion} using TypeSpec.Http; using TypeSpec.Rest; using TypeSpec.Versioning; @@ -42,7 +51,7 @@ namespace Azure.Messaging.EventGrid { #suppress "@azure-tools/typespec-azure-core/documentation-required" "https://github.com/Azure/typespec-azure/issues/3107" enum ServiceApiVersions { @useDependency(Azure.Core.Versions.v1_0_Preview_2) - v2023_06_01_preview: "2023-06-01-preview" + v2023_06_01_preview: "2023-06-01-preview", } @doc("Properties of an event published to an Azure Messaging EventGrid Namespace topic using the CloudEvent 1.0 Schema.") @@ -58,7 +67,7 @@ namespace Azure.Messaging.EventGrid { @doc("Event data specific to the event type, encoded as a base64 string.") data_base64?: bytes; - + @doc("Type of event related to the originating occurrence.") type: string; @@ -101,7 +110,7 @@ namespace Azure.Messaging.EventGrid { @doc("Array of receive responses, one per cloud event.") value: ReceiveDetails[]; } - + @doc("Failed LockToken information.") model FailedLockToken { @doc("LockToken value") @@ -111,7 +120,7 @@ namespace Azure.Messaging.EventGrid { errorCode: string; @doc("Description of the token error.") - errorDescription: string; + errorDescription: string; } @doc("The result of the Publish operation.") @@ -162,133 +171,150 @@ namespace Azure.Messaging.EventGrid { lockTokens: string[]; } - // Publish Operation: - // POST https://{namespaceName}.{region}.eventgrid.azure.net/topics/{topicName}:publish?api-version={apiVersion}} - @doc("Publish Single Cloud Event to namespace topic. In case of success, the server responds with an HTTP 200 status code with an empty JSON object in response. Otherwise, the server can return various error codes. For example, 401: which indicates authorization failure, 403: which indicates quota exceeded or message is too large, 410: which indicates that specific topic is not found, 400: for bad request, and 500: for internal server error. ") - @route("/topics/{topicName}:publish", {shared: true}) - @post op PublishCloudEvent is Azure.Core.RpcOperation<{ - @doc("content type") - @header("content-type") - contentType: "application/cloudevents+json; charset=utf-8"; - - @doc("Topic Name.") - @path - topicName: string; - - @doc("Single Cloud Event being published.") - @body - event: CloudEvent; - }, PublishResult>; - - - @doc("Publish Batch Cloud Event to namespace topic. In case of success, the server responds with an HTTP 200 status code with an empty JSON object in response. Otherwise, the server can return various error codes. For example, 401: which indicates authorization failure, 403: which indicates quota exceeded or message is too large, 410: which indicates that specific topic is not found, 400: for bad request, and 500: for internal server error. ") - @route("/topics/{topicName}:publish", {shared: true}) - @post op PublishCloudEvents is Azure.Core.RpcOperation<{ - @doc("content type") - @header("content-type") - contentType: "application/cloudevents-batch+json; charset=utf-8"; - - @doc("Topic Name.") - @path - topicName: string; + @route( + "/topics/{topicName}:publish", + { + shared: true, + } + ) + @post + op PublishCloudEvent is Azure.Core.RpcOperation< + { + @doc("content type") + @header("content-type") + contentType: "application/cloudevents+json; charset=utf-8"; + + @doc("Topic Name.") + @path + topicName: string; + + @doc("Single Cloud Event being published.") + @body + event: CloudEvent; + }, + PublishResult + >; + + @doc("Publish Batch Cloud Event to namespace topic. In case of success, the server responds with an HTTP 200 status code with an empty JSON object in response. Otherwise, the server can return various error codes. For example, 401: which indicates authorization failure, 403: which indicates quota exceeded or message is too large, 410: which indicates that specific topic is not found, 400: for bad request, and 500: for internal server error. ") + @route( + "/topics/{topicName}:publish", + { + shared: true, + } + ) + @post + op PublishCloudEvents is Azure.Core.RpcOperation< + { + @doc("content type") + @header("content-type") + contentType: "application/cloudevents-batch+json; charset=utf-8"; + + @doc("Topic Name.") + @path + topicName: string; + + @doc("Array of Cloud Events being published.") + @body + events: CloudEvent[]; + }, + PublishResult + >; - @doc("Array of Cloud Events being published.") - @body - events: CloudEvent[]; - }, PublishResult>; - - // Receive Operation: - // POST https://{namespaceName}.{region}.eventgrid.azure.net/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:receive?api-Version={apiVersion}&maxWaitTime=60&maxEvents={maxEvents} - @doc("Receive Batch of Cloud Events from the Event Subscription.") @route("/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:receive") - @post op ReceiveCloudEvents is Azure.Core.RpcOperation<{ - @doc("Topic Name.") - @path - topicName: string; - - @doc("Event Subscription Name.") - @path - eventSubscriptionName: string; - - @doc("Max Events count to be received. Minimum value is 1, while maximum value is 100 events. If not specified, the default value is 1.") - @query - maxEvents?: int32 = 1; - - @doc("Max wait time value for receive operation in Seconds. It is the time in seconds that the server approximately waits for the availability of an event and responds to the request. If an event is available, the broker responds immediately to the client. Minimum value is 10 seconds, while maximum value is 120 seconds. If not specified, the default value is 60 seconds.") - @encode("seconds", int32) - @query - maxWaitTime?: duration; - }, ReceiveResult>; - - // Acknowledge Operation: - // POST https://{namespaceName}.{region}.eventgrid.azure.net/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:acknowledge&apiVersion={apiVersion} + @post + op ReceiveCloudEvents is Azure.Core.RpcOperation< + { + @doc("Topic Name.") + @path + topicName: string; + + @doc("Event Subscription Name.") + @path + eventSubscriptionName: string; + + @doc("Max Events count to be received. Minimum value is 1, while maximum value is 100 events. If not specified, the default value is 1.") + @query + maxEvents?: int32 = 1; + + @doc("Max wait time value for receive operation in Seconds. It is the time in seconds that the server approximately waits for the availability of an event and responds to the request. If an event is available, the broker responds immediately to the client. Minimum value is 10 seconds, while maximum value is 120 seconds. If not specified, the default value is 60 seconds.") + @encode("seconds", int32) + @query + maxWaitTime?: duration; + }, + ReceiveResult + >; @doc("Acknowledge batch of Cloud Events. The server responds with an HTTP 200 status code if at least one event is successfully acknowledged. The response body will include the set of successfully acknowledged lockTokens, along with other failed lockTokens with their corresponding error information. Successfully acknowledged events will no longer be available to any consumer.") - @route("/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:acknowledge") - @post op AcknowledgeCloudEvents is Azure.Core.RpcOperation<{ - @doc("content type") - @header("content-type") - contentType: "application/json; charset=utf-8"; - - @doc("Topic Name.") - @path - topicName: string; - - @doc("Event Subscription Name.") - @path - eventSubscriptionName: string; - - @doc("AcknowledgeOptions.") - @body - lockTokens: AcknowledgeOptions; - }, AcknowledgeResult>; - - // Release Operation: - // POST https://{namespaceName}.{region}.eventgrid.azure.net/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:release?api-version={apiVersion} - + @post + op AcknowledgeCloudEvents is Azure.Core.RpcOperation< + { + @doc("content type") + @header("content-type") + contentType: "application/json; charset=utf-8"; + + @doc("Topic Name.") + @path + topicName: string; + + @doc("Event Subscription Name.") + @path + eventSubscriptionName: string; + + @doc("AcknowledgeOptions.") + @body + lockTokens: AcknowledgeOptions; + }, + AcknowledgeResult + >; + @doc("Release batch of Cloud Events. The server responds with an HTTP 200 status code if at least one event is successfully released. The response body will include the set of successfully released lockTokens, along with other failed lockTokens with their corresponding error information.") @route("/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:release") - @post op ReleaseCloudEvents is Azure.Core.RpcOperation<{ - @doc("content type") - @header("content-type") - contentType: "application/json; charset=utf-8"; - - @doc("Topic Name.") - @path - topicName: string; - - @doc("Event Subscription Name.") - @path - eventSubscriptionName: string; - - @doc("ReleaseOptions") - @body - lockTokens : ReleaseOptions; - }, ReleaseResult>; - - // Reject Operation: - // POST https://{namespaceName}.{region}.eventgrid.azure.net/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:reject?api-version={apiVersion} + @post + op ReleaseCloudEvents is Azure.Core.RpcOperation< + { + @doc("content type") + @header("content-type") + contentType: "application/json; charset=utf-8"; + + @doc("Topic Name.") + @path + topicName: string; + + @doc("Event Subscription Name.") + @path + eventSubscriptionName: string; + + @doc("ReleaseOptions") + @body + lockTokens: ReleaseOptions; + }, + ReleaseResult + >; @doc("Reject batch of Cloud Events.") @route("/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:reject") - @post op RejectCloudEvents is Azure.Core.RpcOperation<{ - @doc("content type") - @header("content-type") - contentType: "application/json; charset=utf-8"; - - @doc("Topic Name.") - @path - topicName: string; - - @doc("Event Subscription Name.") - @path - eventSubscriptionName: string; - - @doc("RejectOptions") - @body - lockTokens : RejectOptions; - }, RejectResult>; + @post + op RejectCloudEvents is Azure.Core.RpcOperation< + { + @doc("content type") + @header("content-type") + contentType: "application/json; charset=utf-8"; + + @doc("Topic Name.") + @path + topicName: string; + + @doc("Event Subscription Name.") + @path + eventSubscriptionName: string; + + @doc("RejectOptions") + @body + lockTokens: RejectOptions; + }, + RejectResult + >; } diff --git a/specification/servicenetworking/ServiceNetworking.Management/main.tsp b/specification/servicenetworking/ServiceNetworking.Management/main.tsp index 4ed23fb8b4d6..63bcfb073153 100644 --- a/specification/servicenetworking/ServiceNetworking.Management/main.tsp +++ b/specification/servicenetworking/ServiceNetworking.Management/main.tsp @@ -21,25 +21,24 @@ using TypeSpec.Versioning; using Azure.Core; using Azure.ResourceManager; - //----------------------- Frontends ----------------------- @doc("Frontend Subresource of Traffic Controller.") @parentResource(TrafficController) -model Frontend is TrackedResource{ +model Frontend is TrackedResource { @key("frontendName") @doc("Frontends") @visibility("read") @path @segment("frontends") @pattern("^[A-Za-z0-9]([A-Za-z0-9-_.]{0,62}[A-Za-z0-9])?$") - name : string; + name: string; } @doc("Frontend Properties.") model FrontendProperties { @visibility("read") @doc("The Fully Qualified Domain Name of the DNS record associated to a Traffic Controller frontend.") - fqdn? : string; + fqdn?: string; @visibility("read") @doc("Provisioning State of Traffic Controller Frontend Resource") @@ -60,20 +59,21 @@ model Association is TrackedResource { } @doc("Association Properties.") -model AssociationProperties { +model AssociationProperties { @doc("Association Type") associationType: AssociationType; + @doc("Association Subnet") subnet?: AssociationSubnet; + @visibility("read") @doc("Provisioning State of Traffic Controller Association Resource") provisioningState?: ProvisioningState; - } #suppress "@azure-tools/typespec-azure-core/documentation-required" "MUST fix in next update" enum AssociationType { - "subnets", + subnets, } @doc("Association Subnet.") @@ -98,12 +98,15 @@ model TrafficControllerProperties { @doc("Configuration Endpoints.") @visibility("read") configurationEndpoints?: string[]; + @visibility("read") @doc("Frontends References List") - frontends? : ResourceId[]; + frontends?: ResourceId[]; + @visibility("read") @doc("Associations References List") - associations? : ResourceId[]; + associations?: ResourceId[]; + @visibility("read") @doc("The status of the last operation.") provisioningState?: ProvisioningState; @@ -111,33 +114,38 @@ model TrafficControllerProperties { #suppress "@azure-tools/typespec-azure-core/documentation-required" "MUST fix in next update" @lroStatus -enum ProvisioningState{ +enum ProvisioningState { Provisioning, Updating, Deleting, Accepted, - Succeeded, - Failed, - Canceled + Succeeded, + Failed, + Canceled, } @doc("Resource ID definition used by parent to reference child resources.") -model ResourceId{ +model ResourceId { @doc("Resource ID of child resource.") - id : string; + id: string; } //----------------------- Paths ----------------------- @armResourceOperations -interface AssociationsInterface extends ResourceInstanceOperations, ResourceListByParent{ -} +interface AssociationsInterface + extends ResourceInstanceOperations, + ResourceListByParent {} @armResourceOperations -interface FrontendsInterface extends ResourceInstanceOperations, ResourceListByParent{ -} +interface FrontendsInterface + extends ResourceInstanceOperations, + ResourceListByParent {} @armResourceOperations -interface TrafficControllerInterface extends TrackedResourceOperations{ -} +interface TrafficControllerInterface + extends TrackedResourceOperations< + TrafficController, + TrafficControllerProperties + > {} interface Operations extends Azure.ResourceManager.Operations {} diff --git a/specification/translation/Azure.AI.TextTranslation/models-translate.tsp b/specification/translation/Azure.AI.TextTranslation/models-translate.tsp index 239c2f7c1611..87e35ec7487f 100644 --- a/specification/translation/Azure.AI.TextTranslation/models-translate.tsp +++ b/specification/translation/Azure.AI.TextTranslation/models-translate.tsp @@ -14,7 +14,9 @@ model TranslateParameters { ...CommonParameters; #suppress "@azure-tools/typespec-azure-core/prefer-csv-collection-format" "Existing Spec" - @query({format: "multi"}) + @query({ + format: "multi", + }) @doc(""" Specifies the language of the output text. The target language must be one of the supported languages included in the translation scope. For example, use to=de to translate to German. diff --git a/specification/translation/Azure.AI.TextTranslation/routes.tsp b/specification/translation/Azure.AI.TextTranslation/routes.tsp index 9f4d59ef2b0f..d7f5b599a8b4 100644 --- a/specification/translation/Azure.AI.TextTranslation/routes.tsp +++ b/specification/translation/Azure.AI.TextTranslation/routes.tsp @@ -13,7 +13,13 @@ using TypeSpec.Http; namespace TextTranslation; @doc("Defines Text Translation custom Operation") -op CustomOperation( +op CustomOperation< + TBody, + TParams, + TResponse, + Traits = {}, + TError = ErrorResponse +>( ...TParams, #suppress "@azure-tools/typespec-azure-core/request-body-problem" "Existing spec"