Skip to content

Fix: Invalid example for @header decorator #7504

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 3 commits into
base: main
Choose a base branch
from

Conversation

bitfl0wer
Copy link

The current documentation for the @header HTTP decorator contains an example which has been valid in v0.6.x, but is not valid in v1.0.0 of TypeSpec.

The current, live example yields the following error:

[{
	"owner": "_generated_diagnostic_collection_name_#0",
	"code": "invalid-argument",
	"severity": 8,
	"message": "Argument of type '{ name: \"header-name\", format: \"csv\" }' is not assignable to parameter of type 'string | TypeSpec.Http.HeaderOptions'",
	"source": "TypeSpec",
	"startLineNumber": 31,
	"startColumn": 21,
	"endLineNumber": 31,
	"endColumn": 72
}]

This PR removes the deprecated "format" key from the example, fixing the issue.

@bitfl0wer bitfl0wer force-pushed the fix-header-example branch from 5916b5d to 6a42b0f Compare May 29, 2025 19:14
@bitfl0wer
Copy link
Author

@microsoft-github-policy-service agree

Copy link
Member

@timotheeguerin timotheeguerin left a comment

Choose a reason for hiding this comment

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

Thanks!

Copy link
Contributor

github-actions bot commented May 29, 2025

All changed packages have been documented.

  • @typespec/http
Show changes

@typespec/http - fix ✏️

Fix: Invalid example for @header decorator

@bitfl0wer bitfl0wer force-pushed the fix-header-example branch from e6fc36c to 1a33611 Compare May 29, 2025 19:22
@bitfl0wer
Copy link
Author

Boop, this is still open 🫵

@timotheeguerin
Copy link
Member

@bitfl0wer the CI is failling, I believe its because the decorator generated TS signatures also need to be updated with the new content. If you run a pnpm build it will do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
meta:website TypeSpec.io updates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants