fix(@typespec/openapi): Report invalid-extension-key error on the offending property name, not the decorator argument#10772
Closed
Copilot wants to merge 4 commits into
Closed
Conversation
…in tagMetadata Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/typespec/sessions/7d85b014-4b8c-4414-a8ac-386bc72e5a02 Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
…ve tests Agent-Logs-Url: https://github.com/microsoft/typespec/sessions/7d85b014-4b8c-4414-a8ac-386bc72e5a02 Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix tagMetadata custom property placement error
fix(@typespec/openapi): Report May 22, 2026
invalid-extension-key error on the offending property name, not the decorator argument
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When using
@tagMetadatawith a custom property missing thex-prefix, theinvalid-extension-keydiagnostic was reported at the wrong location — pointing to the tag name argument instead of the invalid property.Changes
helpers.ts—checkNoAdditionalPropertiesnow accepts an optionalObjectLiteralNodeand resolves the specificObjectLiteralPropertyNodeby name, using itsididentifier node as the diagnostic target. For nested model properties, the innerObjectLiteralNodeis threaded through recursive calls.validateAdditionalInfoModelgains a corresponding optionalnodeparameter.decorators.ts—tagMetadataDecoratorwas incorrectly usinggetArgumentTarget(0)(the tag name string) for alltagMetadatavalidations; fixed togetArgumentTarget(1)and now passes the resolvedObjectLiteralNodefor precise targeting. Same improvement applied to$info.Tests — Added two position-sensitive tests using
extractSquigglesthat assert the diagnostic lands exactly on the invalid property name identifier, both at the root level and within nested objects (e.g.,externalDocs). AddedPlainTesterto the test host for position-sensitive tests that need full control over the compiled source.