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-latest.sh #3815

Conversation

TakahikoKawasaki
Copy link

This script does the following.

  1. Switch to the 'gh-pages' branch.

  2. Copy "schemas/v{major}.{minor}/schema.json" in the 'main' branch to "oas/{major}.{minor}/schema/{YYYY-MM-DD}" in the 'gh-pages' branch. The value of {YYYY-MM-DD} is extracted from the '$id' property in the schema.json file.

  3. Create a symbolic link "latest" under "oas/{major}.{minor}/schema" that points to the "{YYYY-MM-DD}" file.

  4. Copy "schemas/v{major}.{minor}/schema-base.json" in the 'main' branch to "oas/{major}.{minor}/schema-base/{YYYY-MM-DD}" in the 'gh-pages' branch. The value of {YYYY-MM-DD} is extracted from the '$id' property in the schema-base.json file.

  5. Create a symbolic link "latest" under "oas/{major}.{minor}/schema-base" that points to the "{YYYY-MM-DD}" file.

This script does the following.

1. Switch to the 'gh-pages' branch.

2. Copy "schemas/v{major}.{minor}/schema.json" in the 'main' branch to "oas/{major}.{minor}/schema/{YYYY-MM-DD}" in the 'gh-pages' branch. The value of {YYYY-MM-DD} is extracted from the '$id' property in the schema.json file.

3. Create a symbolic link "latest" under "oas/{major}.{minor}/schema" that points to the "{YYYY-MM-DD}" file.

4. Copy "schemas/v{major}.{minor}/schema-base.json" in the 'main' branch to "oas/{major}.{minor}/schema-base/{YYYY-MM-DD}" in the 'gh-pages' branch. The value of {YYYY-MM-DD} is extracted from the '$id' property in the schema-base.json file.

5. Create a symbolic link "latest" under "oas/{major}.{minor}/schema-base" that points to the "{YYYY-MM-DD}" file.
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.

Seems to work with -v 3.1.

Fails for -v 3.0 with error

jq: error (at <stdin>:1666): split input and separator must be strings

@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.

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

@ralfhandl ralfhandl added the script Pull requests that update Bash or JavaScript code label Aug 13, 2024
Comment on lines +341 to +346
# The command to update the 'latest' file.
link_command="cd ${dst_dir} && ln -sf ${date} latest"

# Execute the commands.
__execute_command "${copy_command}"
__execute_command "${link_command}"
Copy link
Contributor

Choose a reason for hiding this comment

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

If #4034 is approved, this needs to become

Suggested change
# The command to update the 'latest' file.
link_command="cd ${dst_dir} && ln -sf ${date} latest"
# Execute the commands.
__execute_command "${copy_command}"
__execute_command "${link_command}"
# The commands to update the 'latest' file.
link_command="cd ${dst_dir} && ln -sf ${date} latest"
link_command2="cd ${dst_dir} && ln -sf ${date} latest.json"
# Execute the commands.
__execute_command "${copy_command}"
__execute_command "${link_command}"
__execute_command "${link_command2}"

@ralfhandl ralfhandl marked this pull request as draft August 23, 2024 11:51
@ralfhandl ralfhandl self-requested a review October 14, 2024 12:30
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.

Steps 3 and 5 (symlink latest) need to be replaced with

  • rename {YYYY-MM-DD}.md to match the date of the new schema file

@lornajane
Copy link
Contributor

I'm closing this pull request since it's no longer needed since the recent changes to the schema publishing process.

@lornajane lornajane closed this Oct 31, 2024
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