-
Notifications
You must be signed in to change notification settings - Fork 285
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
chore(tools): script to bump openapi spec dependency versions #2340
chore(tools): script to bump openapi spec dependency versions #2340
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aldousalvarez Mostly LGTM but I have a few nits as usual. Please see the comments above for the details!
3cbd7c6
to
67343b1
Compare
67343b1
to
7c7b778
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aldousalvarez FYI: I've pushed some changes that were easier to make then explain. Please make the following changes on top of what I had just pushed:
- There are still nested functions, that point was never addressed.
- Don't use regular expression search & replace to perform the version bumps. The files need to be parsed and then the versions need to be updated based on the parsed data not via regex so that the replacements are deterministic and immune to bugs that will later stem from the content of the files changing in a way that will break the regex.
7c7b778
to
e006f9d
Compare
@petermetz Thank you for the update, I have now addressed the changes that you have requested and I already fixed the nested functions and also I have implemented prettier as the one that will format the JSONs. |
e006f9d
to
e7f66a6
Compare
1. Adds a new script that can be executed in order to bump all release versions of the open API specs. These are one of two main categories: 1.1. The top level .info.version property of the OpenAPI spec JSON object 1.2. Any schema component references embedded anywhere deep inside the JSON object that we define our specs as, for example when a connector plugin's endpoint returns a response object whose schema is defined in another package's OpenAPI spec file such as the core-api package's. 2. Fixed a bug in the "prettier" npm script which was pointing to a non- existent configuration file. This was necessary to be fixed in this commit because tests had to be carried out whether the auto-formatting applied by the version bumping script is consistent with the auto-formatting that is applied when we run prettier via the CLI (there was some struggle here to figure out that we have to pre-format the JSON string held in-memory via JSON.stringify() first otherwise the formatted version would diverge from what the CLI does to the .json files on-disk) 3. We had to exclude the tag called v2.0.0-alpha-prerelease because it was incorrectly named unfortunately: it is considered newer than v2.0.0-alpha.1 by the semver-parser package but it is actually older, e.g. we've issued v2.0.0-alpha-prerelease before we issued v2.0.0-alpha.1 (which is our mistake and this is the workaround to rectify that after the fact without having to force delete the tag that we've already pushed to the upstream main branch). This exclusion is applied by default which might turn out to be a mistake later but right now it does not look like there would be an edge case where we need to handle this in any different way. 4. The script is re-entrant and will save a thorough report of what it did to temporary .json files whose names are date and timestamped within the project root's ./build/ subfolder. 5. The target version to bump to can be specified explicitly via the --target-version CLI parameter but if it not provided then will default to whatever is the latest sem-ver compatibly named tag in the git log. Example to specify target version explicitly: `yarn tools:bump-openapi-spec-dep-versions --target-version=v3.2.1` Example to let the script figure out what the target version should be: `yarn tools:bump-openapi-spec-dep-versions` Fixes hyperledger-cacti#2206 Co-authored-by: Peter Somogyvari <peter.somogyvari@accenture.com> Signed-off-by: aldousalvarez <aldousss.alvarez@gmail.com> Signed-off-by: Peter Somogyvari <peter.somogyvari@accenture.com>
e7f66a6
to
ad1dd80
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
versions of the open API specs. These are one of two main categories:
1.1. The top level .info.version property of the OpenAPI spec JSON object
1.2. Any schema component references embedded anywhere deep inside the
JSON object that we define our specs as, for example when a connector
plugin's endpoint returns a response object whose schema is defined in
another package's OpenAPI spec file such as the core-api package's.
existent configuration file. This was necessary to be fixed in this commit
because tests had to be carried out whether the auto-formatting applied
by the version bumping script is consistent with the auto-formatting that
is applied when we run prettier via the CLI (there was some struggle here
to figure out that we have to pre-format the JSON string held in-memory
via JSON.stringify() first otherwise the formatted version would diverge
from what the CLI does to the .json files on-disk)
was incorrectly named unfortunately: it is considered newer than
v2.0.0-alpha.1 by the semver-parser package but it is actually older,
e.g. we've issued v2.0.0-alpha-prerelease before we issued v2.0.0-alpha.1
(which is our mistake and this is the workaround to rectify that after
the fact without having to force delete the tag that we've already
pushed to the upstream main branch).
This exclusion is applied by default which might turn out to be a mistake
later but right now it does not look like there would be an edge case
where we need to handle this in any different way.
to temporary .json files whose names are date and timestamped within the
project root's ./build/ subfolder.
--target-version CLI parameter but if it not provided then will default
to whatever is the latest sem-ver compatibly named tag in the git log.
Example to specify target version explicitly:
yarn tools:bump-openapi-spec-dep-versions --target-version=v3.2.1
Example to let the script figure out what the target version should be:
yarn tools:bump-openapi-spec-dep-versions
Fixes https://github.com/hyperledger/cacti/issues/2206
Co-authored-by: Peter Somogyvari peter.somogyvari@accenture.com
Signed-off-by: aldousalvarez aldousss.alvarez@gmail.com
Signed-off-by: Peter Somogyvari peter.somogyvari@accenture.com