Skip to content

[Key Vault] TypeSpec enhancements and error improvement #34032

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

mccoyp
Copy link
Member

@mccoyp mccoyp commented Apr 17, 2025

Data Plane API Specification Update Pull Request

Tip

Overwhelmed by all this guidance? See the Getting help section at the bottom of this PR description.

This PR proposes three changes:

  1. Modify KeyVaultError's definition to make Error a named nullable union instead of an anonymous model.
    1. This requires a new type, NullableError, to be defined and used as the type of KeyVaultError. This type is just a nullable pointer to Error.
    2. When generating SDK code, KeyVaultErrorError will no longer be emitted (we instead get Error, like we did with Swagger). NullableError is not generated.
  2. Mark version path parameters as optional, per Path parameter cannot be optional is not accurate anymore microsoft/typespec#4126.
    1. This corrects the definitions for operations in Certificates, Keys, and Secrets that accept a version path parameter but don't require one.
    2. There is a Swagger change incurred with "required": true changing to false, but the new value is accurate.
    3. There is another Swagger change incurred with operation paths changing from e.g. "/certificates/{certificate-name}/{certificate-version}" to "/certificates/{certificate-name}{certificate-version}".
  3. Use Azure.Core.Legacy.parameterizedNextLink to make generated clients pass includePending into some Certificates paging requests.
    1. Key Vault paging responses do not include includePending in nextLinks. This means that operations like getCertificates include pending certificates in the first page of responses, but not in subsequent pages.
    2. ListCertificateOptions is defined for referencing an includePending parameter in parameterizedNextLink.
    3. Since getCertificates accepts includePending but getCertificateVersions does not, the return type -- CertificateListResult -- needed to be split into two types: CertificateListResult and CertificateListResultWithPending. The latter parameterizes the includePending parameter into nextLink but the former does not.

nextLink parameterization has been removed from this PR after further discussion; we're currently working with the service team to decide on an appropriate solution to the issue.

PR review workflow diagram

Please understand this diagram before proceeding. It explains how to get your PR approved & merged.

spec_pr_review_workflow_diagram

API Info: The Basics

Most of the information about your service should be captured in the issue that serves as your API Spec engagement record.

  • Link to API Spec 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 API Spec document (if applicable), and the root paths that have been updated.

  • Design Document:
  • Previous API Spec Doc:
  • Updated paths:

Viewing API changes

For convenient view of the API changes made by this PR, refer to the URLs provided in the table
in the Generated ApiView comment added to this PR. You can use ApiView to show API versions diff.

Suppressing failures

If one or multiple validation error/warning suppression(s) is detected in your PR, please follow the
Swagger-Suppression-Process
to get approval.

❔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.

Click here for links to tools, specs, guidelines & other good stuff

Tooling

Guidelines & Specifications

Helpful Links

Getting help

  • First, please carefully read through this PR description, from top to bottom.
  • If you don't have permissions to remove or add labels to the PR, request write access per aka.ms/azsdk/access#request-access-to-rest-api-or-sdk-repositories
  • To understand what you must do next to merge this PR, see the Next Steps to Merge comment. It will appear within few minutes of submitting this PR and will continue to be up-to-date with current PR state.
  • For guidance on fixing this PR CI check failures, see the hyperlinks provided in given failure
    and https://aka.ms/ci-fix.
  • If the PR CI checks appear to be stuck in queued state, please add a comment with contents /azp run.
    This should result in a new comment denoting a PR validation pipeline has started and the checks should be updated after few minutes.
  • If the help provided by the previous points is not enough, post to https://aka.ms/azsdk/support/specreview-channel and link to this PR.

@mccoyp mccoyp added KeyVault TypeSpec Authored with TypeSpec labels Apr 17, 2025
Copy link

openapi-pipeline-app bot commented Apr 17, 2025

Next Steps to Merge

Next steps that must be taken to merge this PR:
  • ❌ This PR targets either the main branch of the public specs repo or the RPSaaSMaster branch of the private specs repo. These branches are not intended for iterative development. Therefore, you must acknowledge you understand that after this PR is merged, the APIs are considered shipped to Azure customers. Any further attempts at in-place modifications to the APIs will be subject to Azure's versioning and breaking change policies. Additionally, for control plane APIs, you must acknowledge that you are following all the best practices documented by ARM at aka.ms/armapibestpractices. If you do intend to release the APIs to your customers by merging this PR, add the PublishToCustomers label to your PR in acknowledgement of the above. Otherwise, retarget this PR onto a feature branch, i.e. with prefix release- (see aka.ms/azsdk/api-versions#release--branches).
  • ❌ This PR has at least one breaking change (label: BreakingChangeReviewRequired).
    To unblock this PR, follow the process at aka.ms/brch.
  • ❌ The required check named spec-gen-sdk - go - pullrequest has failed. Refer to the check in the PR's 'Checks' tab for details on how to fix it and consult the aka.ms/ci-fix guide
  • ❌ The required check named TypeSpec Validation has failed. Refer to the check in the PR's 'Checks' tab for details on how to fix it and consult the aka.ms/ci-fix guide

Copy link

openapi-pipeline-app bot commented Apr 17, 2025

PR validation pipeline restarted successfully. If there is ApiView generated, it will be updated in this comment.

Copy link

github-actions bot commented Apr 17, 2025

API Change Check

APIView identified API level changes in this PR and created the following API reviews

Language API Review for Package
Swagger Microsoft.KeyVault
TypeSpec KeyVault

@AzureRestAPISpecReview AzureRestAPISpecReview added BreakingChangeReviewRequired <valid label in PR review process>add this label when breaking change review is required data-plane labels Apr 17, 2025
@mccoyp mccoyp force-pushed the mccoyp/kv-enabling-rust branch from 3716296 to 9cc2432 Compare May 16, 2025 21:39
@mccoyp mccoyp marked this pull request as ready for review May 17, 2025 02:20
@@ -163,7 +163,7 @@
"name": "certificate-version",
"in": "path",
"description": "The version of the certificate. This URI fragment is optional. If not specified, the latest version of the certificate is returned.",
"required": true,
"required": false,
Copy link
Member

Choose a reason for hiding this comment

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

This will need to be reverted as it's invalid for OpenAPI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BreakingChangeReviewRequired <valid label in PR review process>add this label when breaking change review is required data-plane KeyVault PipelineBotTrigger TypeSpec Authored with TypeSpec
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants