| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| # generate_openapi_schemas.yml | ||
| # | ||
| # Purpose: Generate OpenAPI schemas for the LMS and CMS using drf-spectacular, | ||
| # then open a pull request if either schema changed. The generated schema files | ||
| # are consumed by the openedx-platform-sdk repo's regen_sdk.sh script to keep | ||
| # the SDK in sync with the platform's tagged API views. | ||
|
|
||
| name: Generate OpenAPI Schemas | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
|
|
||
| schedule: | ||
| # Regenerate and commit the full OpenAPI schemas every Monday at 09:00 UTC. | ||
| - cron: "0 9 * * 1" | ||
|
|
||
| jobs: | ||
| generate-schemas: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Check out repository | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 | ||
|
|
||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0 | ||
| with: | ||
| enable-cache: true | ||
|
|
||
| # `default-groups = []` in pyproject.toml means a bare `uv sync` installs | ||
| # no groups at all, which leaves out ora2 and makes both schema steps fail | ||
| # with ModuleNotFoundError. `docs` includes `bundled`, which carries the | ||
| # bundled XBlocks — the same set .readthedocs.yaml and the other workflows | ||
| # install. | ||
| - name: Install dependencies | ||
| run: uv sync --no-default-groups --group docs --frozen | ||
|
|
||
| # `docs.docs_settings` is what `make swagger` uses: it applies the | ||
|
Comment thread
Copy link
Copy Markdown
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityThis comment describes #39108, not master. Without it SPECTACULAR_SETTINGS is the default at lms/envs/common.py:2156 and lms_api_filter keeps only /api/enrollment/v\d+/, so this step overwrites the published LMS reference with the enrollment-only subset. Note the dependency in the description and land #39108 first. On top of it the step is correct: 481 paths against the 293 committed.
Sorry, something went wrong.
Faraz32123 reacted with thumbs up emoji
All reactions
|
||
| # unfiltered /api-docs configuration instead of the narrow, SDK-facing | ||
| # schema that SPECTACULAR_SETTINGS carries by default. Without it this | ||
| # step would overwrite the published LMS reference with the | ||
| # enrollment-only subset. | ||
| # | ||
| # NOTE: docs_settings only carries that unfiltered configuration as of | ||
| # https://github.com/openedx/openedx-platform/pull/39108, which must merge | ||
| # before this workflow runs. | ||
| - name: Generate LMS OpenAPI schema | ||
| run: | | ||
| DJANGO_SETTINGS_MODULE=docs.docs_settings \ | ||
| uv run python manage.py lms spectacular --file docs/lms-openapi.yaml | ||
|
|
||
| # Studio has no docs_settings equivalent. `manage.py cms` defaults to | ||
| # cms.envs.devstack, which imports production.py and so requires a | ||
| # CMS_CFG file that does not exist in CI — settings raise | ||
| # ImproperlyConfigured before the command is even registered. | ||
| # cms.envs.development needs no such file. Its schema is the Authoring | ||
| # API's contentstore-scoped surface, the same one Studio publishes at | ||
| # /authoring-api/schema/. | ||
| - name: Generate CMS OpenAPI schema | ||
| run: | | ||
| DJANGO_SETTINGS_MODULE=cms.envs.development \ | ||
| uv run python manage.py cms spectacular --file docs/cms-openapi.yaml | ||
|
|
||
|
Comment thread
feanil marked this conversation as resolved.
|
||
| - name: Open pull request if schemas changed | ||
| uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8 | ||
| with: | ||
| branch: chore/update-openapi-schemas | ||
| # Without a suffix, a run that happens while the previous PR is | ||
| # still open pushes onto that same branch. Matches | ||
| # compile-python-requirements.yml and upgrade-one-python-dependency.yml. | ||
| branch-suffix: short-commit-hash | ||
| commit-message: | | ||
| chore: regenerate OpenAPI schemas | ||
|
|
||
| Commit generated by workflow `${{ github.workflow_ref }}` | ||
| title: 'chore: update OpenAPI schemas for SDK generation' | ||
| team-reviewers: wg-maintenance-openedx-platform-oncall | ||
| body: | | ||
| ## Auto-generated OpenAPI schema update | ||
|
|
||
| PR generated by workflow `${{ github.workflow_ref }}`. | ||
| It contains regenerated `docs/lms-openapi.yaml` and/or `docs/cms-openapi.yaml` | ||
| files reflecting the latest state of the platform's API views. | ||
|
|
||
| `docs/lms-openapi.yaml` is the full LMS API surface — the same schema | ||
| `make swagger` produces, which the docs build publishes. | ||
| `docs/cms-openapi.yaml` is Studio's tagged schema. | ||
|
|
||
| Both are consumed by the | ||
| [openedx-platform-sdk](https://github.com/edly-io/openedx-platform-sdk) | ||
| repository's `regen_sdk.sh`, which filters them down to the tagged | ||
| operations it generates a client for. | ||
|
|
||
| **Do not edit these files by hand** — they will be overwritten on the next run. | ||
| add-paths: | | ||
| docs/lms-openapi.yaml | ||
| docs/cms-openapi.yaml | ||
| Back | FazBrowse Home | New Git URL |
Uh oh!
There was an error while loading. Please reload this page.