pipelines:check OpenApi schema generation match repo schema (#2388)

This commit is contained in:
petitminion 2025-03-25 17:21:23 +00:00
parent a9927df89c
commit c7bd63d1c1
4 changed files with 25940 additions and 2 deletions

View File

@ -175,7 +175,7 @@ lint_api:
- if: $CI_COMMIT_BRANCH =~ /(stable|develop)/
- changes: [api/**/*]
image: $CI_REGISTRY/funkwhale/ci/python-funkwhale-api:3.11
image: $CI_REGISTRY/funkwhale/ci/python-funkwhale-api:3.13
cache: *api_cache
before_script:
- cd api
@ -339,7 +339,7 @@ build_api_schema:
# Add build_docs rules because it depends on the build_api_schema artifact
- changes: [docs/**/*]
image: $CI_REGISTRY/funkwhale/ci/python-funkwhale-api:3.11
image: $CI_REGISTRY/funkwhale/ci/python-funkwhale-api:3.13
services:
- postgres:15-alpine
- redis:7-alpine
@ -357,6 +357,11 @@ build_api_schema:
- poetry run funkwhale-manage migrate
script:
- poetry run funkwhale-manage spectacular --file ../docs/schema.yml
- diff ../docs/schema.yml ./funkwhale_api/common/schema.yml || (
echo "Schema files do not match! run sudo docker compose run --rm
api funkwhale-manage spectacular > ./api/funkwhale_api/common/schema.yml" &&
exit 1
)
artifacts:
expire_in: 2 weeks
paths:

View File

@ -6,6 +6,7 @@ repos:
rev: v4.4.0
hooks:
- id: check-added-large-files
exclude: "api/funkwhale_api/common/schema.yml"
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-shebang-scripts-are-executable
@ -62,6 +63,7 @@ repos:
hooks:
- id: prettier
files: \.(md|yml|yaml|json)$
exclude: "api/funkwhale_api/common/schema.yml"
- repo: https://github.com/codespell-project/codespell
rev: v2.2.6

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
# OpenApi schema
The frontend need up to date schemas ! If you change the api you need to upgrade the schema by running : `docker compose run --rm api funkwhale-manage spectacular > ./api/funkwhale_api/common/schema.yml`.
Then you need to upgrade the frontend schema has well by running `yarn generate-types-from-local-schema`.
Be aware that `get_signup_form_additional_fields_serializer` can tweak the schema generation.