Skip to content

Commit

Permalink
Merge pull request #18 from blues/pn-remove-dep-params
Browse files Browse the repository at this point in the history
chore: add script to remove deprecated query params from openapi.yaml file before SDK generation
  • Loading branch information
paigen11 authored Nov 22, 2024
2 parents 15c9e1b + 8e4a6a7 commit e7f9b1b
Show file tree
Hide file tree
Showing 12 changed files with 4,999 additions and 100 deletions.
27 changes: 20 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ The [`lib_template`](lib_template/) folder holds the Python generator template f

The [`.github/`](.github/) folder holds a set of GitHub Actions workflows that automate common tasks like [creating PRs](.github/workflows/create-pr.yml) out of new branches and publishing new releases to PyPi.

The [`openapi.yaml`](openapi.yaml) file is a copy of the one in the Notehub repo (a private Blues repository). Anytime a new version of [Notehub.io][notehub] is deployed and the `openapi.yaml` file there is updated, a fresh copy of that file is added to this project in a new branch via a GitHub Actions workflow.
The [`openapi.yaml`](openapi.yaml) file is a copy of the one in the Notehub repo (a private Blues repository). Any time a new version of [Notehub.io][notehub] is deployed and the `openapi.yaml` file there is updated, a fresh copy of that file is added to this project in a new branch via a GitHub Actions workflow.

The [`config.json`](config.json) file is the one that will require changes before a new version of the package is published to PyPi. The [next section](#updating-the-auto-generated-notehub-py-package) will elaborate further.

Expand All @@ -222,11 +222,19 @@ $ git clone [email protected]:blues/notehub-py.git
3. Update the `config.json` file at the project's root so the `packageVersion` parameter is incremented (please follow [semantic versioning](https://semver.org/) practices here).
4. At the root of the project, run the following script command from your terminal:

```shell
$ python3 scripts.py remove_deprecated_parameters
```

This command will make a copy of the `openapi.yaml` file named `openapi_filtered.yaml` which has removed any query parameters marked as `deprecated` from the `openapi.yaml` file. Removing these now deprecated params ensures the generated SDK docs and sample code is clear and up to date, and no longer has potentially confusing artifacts to trip up users.

5. Still at the root of the project, run the following script command from your terminal:

```shell
$ python3 scripts.py generate_package
```

This command will kick off the OpenAPI Generator tool to generate a new copy of the library inside of the `src/` folder, which can then be merged to the `main` repo branch and published to PyPi.
This command will kick off the OpenAPI Generator tool to generate a new copy of the library inside of the `src/` folder (using the newly updated `openapi_filtered.yaml` file), which can then be merged to the `main` repo branch and published to PyPi.

> **NOTE:** If you'd like more information about what exactly the `generate_package` script is doing with its OpenAPI generator CLI commands, you can see the documentation for them [here](https://openapi-generator.tech/docs/usage/).
Expand Down Expand Up @@ -262,22 +270,27 @@ Run the following commands from the `notehub-py` root directory in this order to
### Steps to Publish an Updated notehub_py Package to PyPi

1. Update the `"packageVersion"` in the `config.json` file. Follow [semantic versioning](https://semver.org/) for this.
2. Create a new copy of the `openapi_filtered.yaml` file that removes all deprecated query params from the original `openapi.yaml` file.

```bash
python3 scripts.py remove_deprecated_parameters
```

2. Generate the new version of the package.
3. Generate the new version of the package.

```bash
python3 scripts.py generate_package
```

3. Rebuild the distribution packages for the PyPi package repository.
4. Rebuild the distribution packages for the PyPi package repository.

```bash
python3 scripts.py build_distro_package
```

4. Commit and push the changes to a new branch in GitHub and open a new pull request when the branch is ready for review. See the [contribution documentation](CONTRIBUTING.md) for further details around a good PR and commit messages.
5. Get the PR approved and merged to `main`.
6. Create a new release with a tag following the [semantic versioning](https://semver.org/) style of [vX.X.X], click the "Generate release notes" button, and publish the release. For example: a new release with a tag named v1.0.2.
5. Commit and push the changes to a new branch in GitHub and open a new pull request when the branch is ready for review. See the [contribution documentation](CONTRIBUTING.md) for further details around a good PR and commit messages.
6. Get the PR approved and merged to `main`.
7. Create a new release with a tag following the [semantic versioning](https://semver.org/) style of [vX.X.X], click the "Generate release notes" button, and publish the release. For example: a new release with a tag named v1.0.2.

## Contributing

Expand Down
2 changes: 1 addition & 1 deletion config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"packageName": "notehub_py",
"packageUrl": "https://github.com/blues/notehub-py",
"projectName": "notehub-py",
"packageVersion": "1.0.4"
"packageVersion": "1.0.5"
}
Loading

0 comments on commit e7f9b1b

Please sign in to comment.