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

Change gen_openapi.sh to generate schema with generic mount paths #18934

Merged
merged 3 commits into from
Jan 31, 2023

Conversation

averche
Copy link
Contributor

@averche averche commented Jan 31, 2023

gen_openapi.sh is a script used to generate OpenAPI schema for all built-in plugins. The resultant openapi.json schema is then used for client library generation.

This pull request fixes a couple issues:

  • The script will now ignore plugins marked as "Removed" (these were causing script failures)
  • The will now generate schema with generic_mount_paths set to true, inserting /{thing_mount_path}/ elements into the paths for certain plugins. This was the default behavior before Revert "Add mount path into the default generated openapi.json spec (#17926)" #18617. We are now re-enabling the behavior but specifically for the schemas generated using this script.

@averche averche added this to the 1.13.0-rc1 milestone Jan 31, 2023
@averche averche marked this pull request as ready for review January 31, 2023 23:07
scripts/gen_openapi.sh Outdated Show resolved Hide resolved
@@ -36,7 +36,7 @@ while read -r line; do
codeLinesStarted=true
elif [[ $line == *"databasePlugins:"* ]] ; then
break
elif [ $codeLinesStarted = true ] && [[ $line == *"consts.Deprecated"* || $line == *"consts.PendingRemoval"* ]] ; then
elif [ $codeLinesStarted = true ] && [[ $line == *"consts.Deprecated"* || $line == *"consts.PendingRemoval"* || $line == *"consts.Removed"* ]] ; then
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this based off the comments in the registry like we previously had it? Or is this something new?

Copy link
Contributor

Choose a reason for hiding this comment

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

Just out of curiosity b/c I don't remember anything that had said PendingRemoval or Removed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They are no longer comments but actual struct values:

"app-id": {
Factory: removedFactory,
DeprecationStatus: consts.Removed,
},

What we are doing here (parsing Go code in shell) is kind of gross. I'm just fixing the script while we are still using it.

Copy link
Contributor

Choose a reason for hiding this comment

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

oh okay! gotcha. At least the deprecation status is codified in here though.

@averche averche enabled auto-merge (squash) January 31, 2023 23:25
@averche averche merged commit aa5653a into main Jan 31, 2023
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