Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Use value syntax for @header, and add explode option #6130

Merged
merged 12 commits into from
Feb 28, 2025

Conversation

chrisradek
Copy link
Member

@chrisradek chrisradek commented Feb 24, 2025

Fixes #4114

One question is whether to add a new http-specs test for the explode scenarios as part of this PR. Currently there aren't any specs for headers defined as objects - I presume since swagger doesn't allow it.

Related typespec-azure PR: Azure/typespec-azure#2257

@azure-sdk
Copy link
Collaborator

azure-sdk commented Feb 24, 2025

All changed packages have been documented.

  • @typespec/http-specs
  • @typespec/http
  • @typespec/openapi3
Show changes

@typespec/http - feature ✏️

Updates @header decorator to accept values and adds the explode option.,> Note that using the model expression syntax to pass in arguments, or using the,> format field, are now deprecated.,> ,> diff lang="tsp",> op example1(,> - @header({ name: "ETag" }) etag: string,> + @header(#{ name: "ETag" }) etag: string ,> ): void;,> ,> op example2(,> - @header({ format: "csv" }) list: string[],> + @header list: string[],> ): void;,>

@typespec/http-specs - internal ✏️

Updates http @header usage to value syntax

@typespec/openapi3 - feature ✏️

updates openapi3 to respect @headers explode option and use value syntax

@azure-sdk
Copy link
Collaborator

azure-sdk commented Feb 24, 2025

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

@chrisradek chrisradek enabled auto-merge February 28, 2025 18:09
@chrisradek chrisradek added this pull request to the merge queue Feb 28, 2025
Merged via the queue into microsoft:main with commit c6225cb Feb 28, 2025
24 checks passed
@chrisradek chrisradek deleted the valueof-header branch February 28, 2025 18:37
github-merge-queue bot pushed a commit to Azure/typespec-azure that referenced this pull request Feb 28, 2025
Updates to address microsoft/typespec#4114
Depends on: microsoft/typespec#6130

---------

Co-authored-by: Christopher Radek <Christopher.Radek@microsoft.com>
/**
* The string format of the array. "csv" and "simple" are used interchangeably, as are
* "multi" and "form".
* @deprecated use explode and `@encode` decorator instead.
Copy link
Member

@MaryGao MaryGao Mar 7, 2025

Choose a reason for hiding this comment

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

@timotheeguerin @chrisradek hello I'd like to comfirm two questions here:

  • would this deprecation happen in our March GA scope, I mean any format usage in typespec or compiler interface would be removed and not supported?
  • for header parameter except explode option do we allow to customize allowReserved option for header value also?

/cc @qiaozha

Copy link
Member

Choose a reason for hiding this comment

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

Yes it is being removed. And no what does it mean for header param allow reserve tells uri template you can include / and other uri reserved char this makes not sense for header

Copy link
Member

Choose a reason for hiding this comment

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

The format option wasn't used a single time before in the spec repos, so you have some problem with a spec?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update header decorator to be consistent with new query and path
4 participants