Skip to content

Warn usage of implicitOptionality in @patch with deprecation#9884

Merged
timotheeguerin merged 8 commits intomicrosoft:mainfrom
timotheeguerin:replace-patch-implicit-optionality-warning
May 4, 2026
Merged

Warn usage of implicitOptionality in @patch with deprecation#9884
timotheeguerin merged 8 commits intomicrosoft:mainfrom
timotheeguerin:replace-patch-implicit-optionality-warning

Conversation

@timotheeguerin
Copy link
Copy Markdown
Member

@timotheeguerin timotheeguerin commented Mar 3, 2026

fix #7235

@microsoft-github-policy-service microsoft-github-policy-service Bot added lib:http lib:rest lib:http-specs For issues/prs related to the @typespec/http-specs package meta:website TypeSpec.io updates emitter:openapi3 Issues for @typespec/openapi3 emitter labels Mar 3, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Mar 3, 2026

Open in StackBlitz

npm i https://pkg.pr.new/@typespec/http@9884
npm i https://pkg.pr.new/@typespec/http-specs@9884
npm i https://pkg.pr.new/@typespec/openapi3@9884
npm i https://pkg.pr.new/@typespec/rest@9884

commit: 5af3a0b

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 3, 2026

All changed packages have been documented.

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

@typespec/http-specs - internal ✏️

Add suppressions for deprecated behavior

@typespec/rest - internal ✏️

Add suppressions for deprecated behavior

@typespec/http - deprecation ✏️

Deprecate use of @patch(#{implicitOptionality: true}).,> ,> Migrate using one of the following patterns depending on intended semantics:,> ,> 1. Preserve previous behavior with an explicit patch model (optional properties),> ,> diff lang=typespec,> model Pet {,> name: string;,> age: int32;,> },> ,> + model PetPatch {,> + name?: string;,> + age?: int32;,> + },> ,> ,> - @patch(#{implicitOptionality: true}) op updatePet(@body patch: Pet): void;,> + @patch op updatePet(@body patch: PetPatch): void;,> ,> ,> 2. Use merge-patch semantics explicitly with MergePatchUpdate<T>,> ,> typespec,> model Pet {,> name: string;,> age: int32;,> },> ,> @patch op updatePet(@body patch: MergePatchUpdate<Pet>): void;,> ,> ,> Use MergePatchCreateOrUpdate<T> when the operation supports create-or-update behavior.

@azure-sdk
Copy link
Copy Markdown
Collaborator

azure-sdk commented Mar 3, 2026

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

@microsoft-github-policy-service microsoft-github-policy-service Bot added the stale Mark a PR that hasn't been recently updated and will be closed. label Apr 3, 2026
@lirenhe
Copy link
Copy Markdown
Member

lirenhe commented Apr 16, 2026

@timotheeguerin, looks this PR has been there for long time, would you continue with this effort? We don't want new Patch operations to have implicitOptionality

@timotheeguerin timotheeguerin added the int:azure-specs Run integration tests against azure-rest-api-specs label Apr 16, 2026
@timotheeguerin timotheeguerin changed the title Replace warning to use implicitOptionality in @patch with deprecation Warn usage of implicitOptionality in @patch with deprecation Apr 28, 2026
@timotheeguerin timotheeguerin marked this pull request as ready for review April 28, 2026 13:06
Comment thread .chronus/changes/replace-patch-implicit-optionality-warning-2026-2-3-15-59-37.md Outdated
@markcowl markcowl added the deprecation A previously supported feature will now report a warning and eventually be removed label Apr 29, 2026
Co-authored-by: Copilot <copilot@github.com>
@timotheeguerin timotheeguerin added this pull request to the merge queue May 4, 2026
Merged via the queue into microsoft:main with commit 2f9a2c2 May 4, 2026
29 of 31 checks passed
@timotheeguerin timotheeguerin deleted the replace-patch-implicit-optionality-warning branch May 4, 2026 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

deprecation A previously supported feature will now report a warning and eventually be removed emitter:openapi3 Issues for @typespec/openapi3 emitter int:azure-specs Run integration tests against azure-rest-api-specs lib:http lib:http-specs For issues/prs related to the @typespec/http-specs package lib:rest meta:website TypeSpec.io updates stale Mark a PR that hasn't been recently updated and will be closed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove patch-implicit-optional notice warning

4 participants