azure-rest-api-specs
azure-rest-api-specs copied to clipboard
feature/cognitiveservices/openai, model Completion for response body
All SDK would required a named model for response body. Hence make a model for Completion
response body; an alias CompletionResponse
for the whole response (includes headers).
It could also relate to issue on getEffectiveModelType
https://github.com/microsoft/cadl/issues/1511
In original Cadl source (Completion
model includes header):
cadl-autorest works because it uses getEffectivePayloadType, which would directly use Completion
model (as it is not anonymous), and then in final schema output remove the header property.
Data Plane API - Pull Request
API Info: The Basics
Most of the information about your service should be captured in the issue that serves as your engagement record.
- Link to engagement record issue:
Is this review for (select one):
- [ ] a private preview
- [ ] a public preview
- [ ] GA release
Change Scope
This section will help us focus on the specific parts of your API that are new or have been modified.
Please share a link to the design document for the new APIs, a link to the previous Open API document (swagger) if applicable, and the root paths that have been updated.
- Design Document:
- Previous Open API Doc:
- Updated paths:
❔Got questions? Need additional info?? We are here to help!
Contact us!
The Azure API Review Board is dedicated to helping you create amazing APIs. You can read about our mission and learn more about our process on our wiki.
- 💬 Teams Channel
Click here for links to tools, specs, guidelines & other good stuff
Tooling
- Open API validation tools were run on this PR. Go here to see how to fix errors
- Spectral Linting
- Open API Hub
Guidelines & Specifications
Helpful Links
Hi, @weidongxu-microsoft Thanks for your PR. I am workflow bot for review process. Here are some small tips.
Swagger Validation Report
️️✔️
BreakingChange succeeded [Detail] [Expand]
There are no breaking changes.
️️✔️
Breaking Change(Cross-Version) succeeded [Detail] [Expand]
There are no breaking changes.
️️✔️
LintDiff succeeded [Detail] [Expand]
Validation passes for LintDiff.
️️✔️
Avocado succeeded [Detail] [Expand]
Validation passes for Avocado.
️️✔️
ModelValidation succeeded [Detail] [Expand]
Validation passes for ModelValidation.
️️✔️
SemanticValidation succeeded [Detail] [Expand]
Validation passes for SemanticValidation.
️️✔️
PrettierCheck succeeded [Detail] [Expand]
Validation passes for PrettierCheck.
️️✔️
SpellCheck succeeded [Detail] [Expand]
Validation passes for SpellCheck.
️❌
CadlValidation: 4 Errors, 20 Warnings failed [Detail]
Rule | Message |
---|---|
MissingExamplesDirectory |
"details":"The 'examples' directory is missing in the cadl folder specification/cognitiveservices/OpenAI.Authoring, please ensure the 'examples' is added in the PR." |
InConsistentSwagger |
"details":"The generated swagger file 2022-06-01-preview/openapi.json from cadl specification/cognitiveservices/OpenAI.Authoring is not the same as the '/mnt/vss/_work/1/azure-rest-api-specs/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2022-06-01-preview/azureopenai.json' in PR, please make sure the swagger is consistent with the generated swagger. You can find the difference in the pipeline log." |
MissingExamplesDirectory |
"details":"The 'examples' directory is missing in the cadl folder specification/cognitiveservices/OpenAI.Inference, please ensure the 'examples' is added in the PR." |
InConsistentSwagger |
"details":"The generated swagger file 2022-06-01-preview/openapi.json from cadl specification/cognitiveservices/OpenAI.Inference is not the same as the '/mnt/vss/_work/1/azure-rest-api-specs/specification/cognitiveservices/data-plane/AzureOpenAI/authoring/preview/2022-06-01-preview/azureopenai.json' in PR, please make sure the swagger is consistent with the generated swagger. You can find the difference in the pipeline log." |
:warning: @azure-tools/cadl-azure-core/casing-style | The names of Property types must use camelCase Location: cognitiveservices/OpenAI.Inference/models/completions.create.cadl#L127 |
:warning: @azure-tools/cadl-azure-core/casing-style | The names of Property types must use camelCase Location: cognitiveservices/OpenAI.Inference/models/completions.create.cadl#L165 |
:warning: @azure-tools/cadl-azure-core/casing-style | The names of Property types must use camelCase Location: cognitiveservices/OpenAI.Inference/models/completions.create.cadl#L155 |
:warning: @azure-tools/cadl-azure-core/casing-style | The names of Property types must use camelCase Location: cognitiveservices/OpenAI.Inference/models/embeddings.create.cadl#L12 |
:warning: @azure-tools/cadl-azure-core/documentation-required | The ModelProperty named 'object' should have a documentation or description, please use decorator @doc to add it. Location: cognitiveservices/OpenAI.Inference/models/embeddings.create.cadl#L26 |
:warning: @azure-tools/cadl-azure-core/documentation-required | The Model named 'Embedding' should have a documentation or description, please use decorator @doc to add it. Location: cognitiveservices/OpenAI.Inference/models/embeddings.create.cadl#L35 |
:warning: @azure-tools/cadl-azure-core/documentation-required | The ModelProperty named 'embedding' should have a documentation or description, please use decorator @doc to add it. Location: cognitiveservices/OpenAI.Inference/models/embeddings.create.cadl#L37 |
:warning: @azure-tools/cadl-azure-core/casing-style | The names of Property types must use camelCase Location: cognitiveservices/OpenAI.Inference/models/completions.create.cadl#L21 |
:warning: @azure-tools/cadl-azure-core/casing-style | The names of Property types must use camelCase Location: cognitiveservices/OpenAI.Inference/models/completions.create.cadl#L47 |
:warning: @azure-tools/cadl-azure-core/casing-style | The names of Property types must use camelCase Location: cognitiveservices/OpenAI.Inference/models/completions.create.cadl#L96 |
:warning: @azure-tools/cadl-azure-core/casing-style | The names of Property types must use camelCase Location: cognitiveservices/OpenAI.Inference/models/completions.create.cadl#L109 |
:warning: @azure-tools/cadl-azure-core/documentation-required | The Model named 'Usage' should have a documentation or description, please use decorator @doc to add it. Location: cognitiveservices/OpenAI.Inference/models/embeddings.create.cadl#L30 |
:warning: @azure-tools/cadl-azure-core/documentation-required | The ModelProperty named 'total_tokens' should have a documentation or description, please use decorator @doc to add it. Location: cognitiveservices/OpenAI.Inference/models/embeddings.create.cadl#L32 |
:warning: @azure-tools/cadl-azure-core/casing-style | The names of Property types must use camelCase Location: cognitiveservices/OpenAI.Inference/models/embeddings.create.cadl#L32 |
:warning: @azure-tools/cadl-autorest/union-unsupported | Unions containing multiple model types cannot be emitted to OpenAPI v2 unless the union is between one model type and 'null'. Location: cognitiveservices/OpenAI.Inference/models/embeddings.create.cadl#L22 |
:warning: @azure-tools/cadl-autorest/union-unsupported | Unions containing multiple model types cannot be emitted to OpenAPI v2 unless the union is between one model type and 'null'. Location: cognitiveservices/OpenAI.Inference/models/completions.create.cadl#L124 |
:warning: MissingCadlProjectConfig | "details":"The configuration 'output-file' for '@azure-tools/cadl-autorest' is missing in the cadl-project.yaml under folder specification/cognitiveservices/OpenAI.Authoring, please ensure it is added in the configuration of the emitter '@azure-tools/cadl-autorest'." |
:warning: MissingCadlProjectConfig | "details":"The configuration 'azure-resource-provider-folder' for '@azure-tools/cadl-autorest' is missing in the cadl-project.yaml under folder specification/cognitiveservices/OpenAI.Authoring, please ensure it is added in the configuration of the emitter '@azure-tools/cadl-autorest'." |
:warning: MissingCadlProjectConfig | "details":"The configuration 'output-file' for '@azure-tools/cadl-autorest' is missing in the cadl-project.yaml under folder specification/cognitiveservices/OpenAI.Inference, please ensure it is added in the configuration of the emitter '@azure-tools/cadl-autorest'." |
:warning: MissingCadlProjectConfig | "details":"The configuration 'azure-resource-provider-folder' for '@azure-tools/cadl-autorest' is missing in the cadl-project.yaml under folder specification/cognitiveservices/OpenAI.Inference, please ensure it is added in the configuration of the emitter '@azure-tools/cadl-autorest'." |
️️✔️
PR Summary succeeded [Detail] [Expand]
Validation passes for Summary.
Swagger Generation Artifacts
️️✔️
ApiDocPreview succeeded [Detail] [Expand]
️️✔️
SDK Breaking Change Tracking succeeded [Detail] [Expand]
Breaking Changes Tracking
Swagger pipeline started successfully. If there is ApiView generated, it will be updated in this comment.
@lmazuel
Let me know if this change is acceptable. Personally I feel we should always provide a clean model for response body, as almost all SDK need to generate a class/model/type for response body.
Alternatively, if we don't want this PR, emitter can add this "remove non-payload property" logic (for all SDKs). https://github.com/Azure/cadl-azure/blob/main/packages/cadl-autorest/src/openapi.ts#L1365-L1367
(Deleted some comments that were meant to go on https://github.com/microsoft/cadl/issues/1511)