Skip to content
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

[new] scripts/update-schema-id.sh #3814

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

TakahikoKawasaki
Copy link

This script updates the schema IDs in the following YAML files:

  • schemas/v{major}.{minor}/schema.yaml
  • schemas/v{major}.{minor}/schema-base.yaml

and generates the following JSON files from the updated YAML files:

  • schemas/v{major}.{minor}/schema.json
  • schemas/v{major}.{minor}/schema-base.json

This script updates the schema IDs in the following YAML files:

- schemas/v{major}.{minor}/schema.yaml
- schemas/v{major}.{minor}/schema-base.yaml

and generates the following JSON files from the updated YAML files:

- schemas/v{major}.{minor}/schema.json
- schemas/v{major}.{minor}/schema-base.json
Copy link
Contributor

@ralfhandl ralfhandl left a comment

Choose a reason for hiding this comment

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

Ran the script with -v 3.1 and it worked fine.

Running with -v 3.0 showed problems:

  • schema.yaml was not updated
  • schema-base.yaml was created empty
  • schema-base.json was created with content null

@ralfhandl
Copy link
Contributor

Hi @TakahikoKawasaki,

Thanks for providing the script.

The script works fine for the v3.1 case with separate schema and schema-base, and fail for the v3.0 case where there is only schema.

Would you mind adding this distinction to the scripts?

Thanks in advance!

@TakahikoKawasaki
Copy link
Author

@ralfhandl

  • Updated the script to support the version 3.0.
  • Versions older than 3.0 are rejected on the assumption that maintenance of 2.x and older versions has stopped.

If it is necessary to support versions older than 3.0, please let me know.

@miqui
Copy link
Contributor

miqui commented Jun 9, 2024

@ralfhandl script so far looks good to me, but I'll let you run with it.

Copy link
Contributor

@ralfhandl ralfhandl left a comment

Choose a reason for hiding this comment

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

Works for both v3.1 and v3.0

@karenetheridge
Copy link
Member

I see you're using ex (which is a neutered form of vim) to do the substitutions -- I'm wondering why you made this choice, vs. the more usual choice of sed which provides access to a richer set of regular expressions?

@TakahikoKawasaki
Copy link
Author

@karenetheridge Sorry, I did not know the -i option of sed. The ex command line can be replaced with sed if it is desired.

@ralfhandl ralfhandl added the script Pull requests that update Bash or JavaScript code label Aug 13, 2024
@ralfhandl ralfhandl marked this pull request as draft August 23, 2024 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Schema script Pull requests that update Bash or JavaScript code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants