Skip to content

fix: handle unknown specification kinds - #976

Open
Devansh-567 wants to merge 1 commit into
json-schema-org:mainfrom
Devansh-567:fix/annotate-specification-links-get
Open

Devansh-567 wants to merge 1 commit into
json-schema-org:mainfrom
Devansh-567:fix/annotate-specification-links-get

Conversation

@Devansh-567

Copy link
Copy Markdown

Summary

bin/annotate-specification-links currently looks up URL templates using version_urls[kind]. If kind is not present in specification_urls.json, this raises a KeyError before the subsequent None check can run, making the intended error-handling path unreachable.

This change replaces the dictionary indexing with version_urls.get(kind), allowing unknown specification kinds to be handled gracefully by emitting the existing annotation instead of terminating the script with a traceback.

Changes

  • Replace version_urls[kind] with version_urls.get(kind) in bin/annotate-specification-links.

Why

The code already contains logic to handle missing URL templates:

url_template = version_urls.get(kind)
if url_template is None:
    ...

@Devansh-567
Devansh-567 requested a review from a team as a code owner July 10, 2026 10:48
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.

1 participant