Skip to content

Warn on unrecognized keys in target dictionaries - #1660

Open
FawwazLawal wants to merge 1 commit into
yonaskolb:masterfrom
FawwazLawal:fix/1645-unrecognized-target-key-warning
Open

FawwazLawal wants to merge 1 commit into
yonaskolb:masterfrom
FawwazLawal:fix/1645-unrecognized-target-key-warning

Conversation

@FawwazLawal

Copy link
Copy Markdown

Summary

Target.init(name:jsonDictionary:) silently ignores unknown keys, so a typo like resources instead of sources produces no output and no error. This adds a validation warning that names the target and the unrecognized key.

A new Target.recognizedKeys set (32 keys, including platformPrefix and platformSuffix read at Target.swift:217-218) is checked in SpecLoader.validateWarnings(). Unrecognized keys produce a SpecValidationError.unrecognizedTargetKey warning with a message like Target "MyTarget" has unrecognized key "resources".

Tests cover both the warning case and the clean-spec case. CHANGELOG entry added.

5 files changed, 80 insertions(+), 1 deletion(-)

Note: swift test could not be run in this environment (Swift 6.2 build issue unrelated to this change).

Resolves #1645

Adds a validation warning when a target dictionary contains keys not in
Target.recognizedKeys, helping catch typos like `resources` instead of
`sources`.

Resolves yonaskolb#1645

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unrecognized target keys (e.g. resources:) are silently ignored — should warn

1 participant