Skip to content

Commit

Permalink
Merge pull request #12 from exasol/feature/#8-Add_CI_task_to_check_if…
Browse files Browse the repository at this point in the history
…_the_generated_API_is_outdated

Feature/#8 add ci task to check if the generated api is outdated
  • Loading branch information
ckunki authored Apr 19, 2024
2 parents cb2f783 + a334a17 commit a84e6e8
Show file tree
Hide file tree
Showing 91 changed files with 9,626 additions and 15 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/check-api-outdated.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Check if OpenAPI is Outdated

on:
push:
branches-ignore:
- "github-pages/*"
- "gh-pages/*"
pull_request:
# check results of former push could be outdated
types: [opened, reopened]
workflow_dispatch:
schedule:
# “At 4 am on every day.” (https://crontab.guru)
- cron: "0 4 * * *"


jobs:

check-api-outdated:
name: Check if OpenAPI Generated From JSON is Outdated
runs-on: ubuntu-latest
strategy:
fail-fast: false

steps:
- name: SCM Checkout
uses: actions/checkout@v3

- name: Setup Python & Poetry Environment
uses: exasol/python-toolbox/.github/actions/[email protected]
with:
python-version: "3.10"

- name: Run Nox Task check-api-outdated
run: poetry run nox -s check-api-outdated

- name: Report Failure Status to Slack Channel
if: ${{ failure() }}
uses: ravsamhq/notify-slack-action@v2
with:
status: ${{ job.status }}
token: ${{ github.token }}
notification_title: "Generated OpenAPI seems to be outdated."
message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>"
notify_when: "failure,cancelled,warnings,skipped"
env:
SLACK_WEBHOOK_URL: ${{ secrets.INTEGRATION_TEAM_SLACK_NOTIFICATION_WEBHOOK }}
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,10 @@

API enabling Python applications connecting to Exasol database SaaS instances and using their SaaS services.

The model layer of this API is generated from the OpenAPI specification in JSON format of the SaaS API https://cloud.exasol.com/openapi.json using [openapi-python-client](https://github.com/openapi-generators/openapi-python-client).

A GitHub action will check each morning if the generated model layer is outdated.

See
* [User Guide](doc/user_guide/user-guide.md)
* [Developer Guide](doc/developer_guide/developer_guide.md)
1 change: 1 addition & 0 deletions doc/changes/changes_0.1.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ n/a
## Feature

* #6: Added Nox task for generating the API
* #8: Add CI task to check if the generated API is outdated
16 changes: 5 additions & 11 deletions doc/developer_guide/developer_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@

saas-api-python includes a file `.pre-commit-config.yaml`.

The following command installs the pre-commit hooks, see also [framework pre-commmit](https://pre-commit.com/) and Git
documentation on [Customizing Git Git Hooks](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks):
The following command installs the pre-commit hooks, see also [framework pre-commmit](https://pre-commit.com/) and Git documentation on [Customizing Git Git Hooks](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks):

```shell
poetry run pre-commit install
Expand All @@ -15,24 +14,19 @@ When the hooks are installed, then git will run each of the hooks on the resp. s

## Generate the API Model

The model layer of this API has been generated from the OpenAPI specification
in JSON format of the SaaS API https://cloud.exasol.com/openapi.json using
[openapi-python-client](https://github.com/openapi-generators/openapi-python-client).
The model layer of this API has been generated from the OpenAPI specification in JSON format of the SaaS API https://cloud.exasol.com/openapi.json using [openapi-python-client](https://github.com/openapi-generators/openapi-python-client).

See also
[API Documentation](https://docs.exasol.com/saas/administration/rest_api/rest_api.htm)
and [Swagger UI](https://cloud.exasol.com/openapi/index.html).
See also [API Documentation](https://docs.exasol.com/saas/administration/rest_api/rest_api.htm) and [Swagger UI](https://cloud.exasol.com/openapi/index.html).

In order to regenerate the model layer please use the following command line:

```shell
poetry run nox generate-api
```

### Change the Source URL of API Model JSON Definition
### Change the Source URL of the API Model JSON Definition

If you want to retrieve the JSON definition for the API model from a different
source then just edit file `noxfile.py`.
If you want to retrieve the JSON definition for the API model from a different source then just edit file `noxfile.py`.

### Read JSON definition From a Local File

Expand Down
15 changes: 11 additions & 4 deletions exasol/saas/client/openapi/__init__.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions exasol/saas/client/openapi/api/__init__.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file.
221 changes: 221 additions & 0 deletions exasol/saas/client/openapi/api/clusters/create_cluster.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit a84e6e8

Please sign in to comment.