Skip to content

Correct annotation python script to correctly work with rfc and iso links #761

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

Merged

Conversation

OptimumCode
Copy link

@OptimumCode OptimumCode commented Feb 7, 2025

Currently, the script cannot process links for rfc and iso - it does not trim the number suffix from a key and it cannot find the right URL template because of that. An example of an unsuccessful run can be found here:
https://github.com/json-schema-org/JSON-Schema-Test-Suite/actions/runs/13163116845/job/36736600257?pr=760

This PR corrects that behaviour and correctly extracts the URL kind and a spec from the key in the specification block. Also, it adds an additional check to avoid a crash in case of an incorrect kind - the error will be reported as an annotation.

The URL template for RFC had incorrect spec path - it was also updated (there is also an issue with anchor - txt format does not support them, but this will be changed in a separate PR)

@OptimumCode OptimumCode requested a review from a team as a code owner February 7, 2025 11:02
@OptimumCode
Copy link
Author

@Julian could you please take a look? I executed the scripts locally with RFC and ISO specs - all looks good now

@Julian
Copy link
Member

Julian commented Feb 7, 2025

Let's try it, thanks!

@Julian Julian merged commit 9c5d99b into json-schema-org:main Feb 7, 2025
2 checks passed
"""
Extracts specification number and kind from the defined key
"""
can_have_spec = ["rfc", "iso"]
Copy link
Author

Choose a reason for hiding this comment

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

note: we could infer that from URITemplate.variable_names by checking if a template has a spec variable (but the ISO template must be configured in that case)

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.

2 participants