root: cleanup API generation (#21172)

This commit is contained in:
Marc 'risson' Schmitt
2026-03-26 13:48:01 +00:00
committed by GitHub
parent ef1d0b0279
commit 31ab7e3ca4
9 changed files with 33 additions and 26 deletions

View File

@@ -9,7 +9,5 @@ build_docs/**
**/*Dockerfile **/*Dockerfile
blueprints/local blueprints/local
.git .git
!gen-ts-api/node_modules
!gen-ts-api/dist/**
!gen-go-api/
.venv .venv
target/

1
.gitignore vendored
View File

@@ -220,7 +220,6 @@ media/
*mmdb *mmdb
.idea/ .idea/
/gen-*/
data/ data/
# Local Netlify folder # Local Netlify folder

View File

@@ -15,8 +15,6 @@ else
SED_INPLACE = sed -i SED_INPLACE = sed -i
endif endif
GEN_API_PY = gen-py-api
BREW_LDFLAGS := BREW_LDFLAGS :=
BREW_CPPFLAGS := BREW_CPPFLAGS :=
BREW_PKG_CONFIG_PATH := BREW_PKG_CONFIG_PATH :=
@@ -188,7 +186,7 @@ gen-changelog: ## (Release) generate the changelog based from the commits since
gen-diff: ## (Release) generate the changelog diff between the current schema and the last version gen-diff: ## (Release) generate the changelog diff between the current schema and the last version
$(eval last_version := $(shell git tag --list 'version/*' --sort 'version:refname' | grep -vE 'rc\d+$$' | tail -1)) $(eval last_version := $(shell git tag --list 'version/*' --sort 'version:refname' | grep -vE 'rc\d+$$' | tail -1))
git show ${last_version}:schema.yml > schema-old.yml git show ${last_version}:schema.yml > schema-old.yml
docker compose -f scripts/api/compose.yml run --rm --user "${UID}:${GID}" diff \ docker compose -f scripts/compose.yml run --rm --user "${UID}:${GID}" diff \
--markdown \ --markdown \
/local/diff.md \ /local/diff.md \
/local/schema-old.yml \ /local/schema-old.yml \
@@ -198,11 +196,6 @@ gen-diff: ## (Release) generate the changelog diff between the current schema a
$(SED_INPLACE) 's/}/}/g' diff.md $(SED_INPLACE) 's/}/}/g' diff.md
npx prettier --write diff.md npx prettier --write diff.md
gen-clean-py: ## Remove generated API client for Python
rm -rf ${PWD}/${GEN_API_PY}
gen-clean: gen-clean-ts gen-clean-py ## Remove generated API clients
gen-client-go: ## Build and install the authentik API for Golang gen-client-go: ## Build and install the authentik API for Golang
make -C "${PWD}/packages/client-go" build make -C "${PWD}/packages/client-go" build
@@ -214,12 +207,6 @@ gen-client-ts: ## Build and install the authentik API for Typescript into the a
make -C "${PWD}/packages/client-ts" build make -C "${PWD}/packages/client-ts" build
npm --prefix web install npm --prefix web install
gen-client-py: gen-clean-py ## Build and install the authentik API for Python
mkdir -p ${PWD}/${GEN_API_PY}
git clone --depth 1 https://github.com/goauthentik/client-python.git ${PWD}/${GEN_API_PY}
cp ${PWD}/schema.yml ${PWD}/${GEN_API_PY}
make -C ${PWD}/${GEN_API_PY} build version=${NPM_VERSION}
_gen-clients: gen-client-go gen-client-rust gen-client-ts _gen-clients: gen-client-go gen-client-rust gen-client-ts
gen-clients: ## Build and install API clients used by authentik gen-clients: ## Build and install API clients used by authentik
$(MAKE) _gen-clients -j $(MAKE) _gen-clients -j

View File

@@ -230,7 +230,6 @@
"schema.yml", // OpenAPI schema "schema.yml", // OpenAPI schema
"./blueprints/schema.json", // Generated blueprint schema "./blueprints/schema.json", // Generated blueprint schema
"custom-elements.json", // TypeScript custom element definitions "custom-elements.json", // TypeScript custom element definitions
"./gen-*-api", // Generated API Client
"./packages/client-go", // Generated API Client "./packages/client-go", // Generated API Client
"./packages/client-rust/src", // Generated API Client "./packages/client-rust/src", // Generated API Client
"./packages/client-ts/src", // Generated API Client "./packages/client-ts/src", // Generated API Client

View File

@@ -6,6 +6,10 @@ FROM --platform=${BUILDPLATFORM} docker.io/library/node:24 AS web-builder
ENV NODE_ENV=production ENV NODE_ENV=production
WORKDIR /static WORKDIR /static
# These files need to be copied and cannot be mounted as `npm ci` will build the client's typescript
COPY ./packages /packages
COPY ./web/packages /static/packages
COPY package.json / COPY package.json /
RUN --mount=type=bind,target=/static/package.json,src=./web/package.json \ RUN --mount=type=bind,target=/static/package.json,src=./web/package.json \
--mount=type=bind,target=/static/package-lock.json,src=./web/package-lock.json \ --mount=type=bind,target=/static/package-lock.json,src=./web/package-lock.json \

12
package-lock.json generated
View File

@@ -6788,7 +6788,7 @@
"@goauthentik/prettier-config": "../prettier-config", "@goauthentik/prettier-config": "../prettier-config",
"@goauthentik/tsconfig": "../tsconfig", "@goauthentik/tsconfig": "../tsconfig",
"@types/eslint": "^9.6.1", "@types/eslint": "^9.6.1",
"@types/node": "^25.3.0", "@types/node": "^25.5.0",
"typescript": "^6.0.2", "typescript": "^6.0.2",
"typescript-eslint": "^8.57.2" "typescript-eslint": "^8.57.2"
}, },
@@ -6819,12 +6819,12 @@
"@eslint/js": "^9.39.3", "@eslint/js": "^9.39.3",
"@goauthentik/prettier-config": "../prettier-config", "@goauthentik/prettier-config": "../prettier-config",
"@goauthentik/tsconfig": "../tsconfig", "@goauthentik/tsconfig": "../tsconfig",
"@types/node": "^25.3.0", "@types/node": "^25.5.0",
"eslint": "^9.39.3", "eslint": "^9.39.3",
"pino": "^10.3.1", "pino": "^10.3.1",
"pino-pretty": "^13.1.2", "pino-pretty": "^13.1.2",
"prettier": "^3.8.1", "prettier": "^3.8.1",
"prettier-plugin-packagejson": "^3.0.0", "prettier-plugin-packagejson": "^3.0.2",
"typescript": "^6.0.2", "typescript": "^6.0.2",
"typescript-eslint": "^8.57.2" "typescript-eslint": "^8.57.2"
}, },
@@ -6859,7 +6859,7 @@
"@types/node": "^25.0.0", "@types/node": "^25.0.0",
"eslint": "^9.39.3", "eslint": "^9.39.3",
"prettier": "^3.8.1", "prettier": "^3.8.1",
"prettier-plugin-packagejson": "^3.0.0", "prettier-plugin-packagejson": "^3.0.2",
"typescript": "^6.0.2", "typescript": "^6.0.2",
"typescript-eslint": "^8.57.2" "typescript-eslint": "^8.57.2"
}, },
@@ -6869,12 +6869,12 @@
}, },
"peerDependencies": { "peerDependencies": {
"prettier": "^3.8.1", "prettier": "^3.8.1",
"prettier-plugin-packagejson": "^3.0.0" "prettier-plugin-packagejson": "^3.0.2"
} }
}, },
"packages/tsconfig": { "packages/tsconfig": {
"name": "@goauthentik/tsconfig", "name": "@goauthentik/tsconfig",
"version": "1.0.7", "version": "1.0.8",
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">=24", "node": ">=24",

View File

@@ -181,7 +181,6 @@ max-returns = 10
[tool.mypy] [tool.mypy]
plugins = ["mypy_django_plugin.main", "mypy_drf_plugin.main", "pydantic.mypy"] plugins = ["mypy_django_plugin.main", "mypy_drf_plugin.main", "pydantic.mypy"]
exclude = ['^gen-py-api/']
[[tool.mypy.overrides]] [[tool.mypy.overrides]]
module = ["django_tenants.*", "dramatiq.*", "pglock.*"] module = ["django_tenants.*", "dramatiq.*", "pglock.*"]

View File

@@ -30,6 +30,13 @@ services:
ports: ports:
- 127.0.0.1:8969:8969 - 127.0.0.1:8969:8969
restart: always restart: always
gen:
image: docker.io/openapitools/openapi-diff:2.1.7
entrypoint: "/bin/true"
restart: never
network_mode: none
volumes:
- ../:/local:ro
volumes: volumes:
db-data: db-data:

14
web/package-lock.json generated
View File

@@ -18446,6 +18446,20 @@
"typescript": "^4.0 || ^5.0" "typescript": "^4.0 || ^5.0"
} }
}, },
"packages/client-ts/node_modules/typescript": {
"version": "5.9.3",
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz",
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
"dev": true,
"license": "Apache-2.0",
"bin": {
"tsc": "bin/tsc",
"tsserver": "bin/tsserver"
},
"engines": {
"node": ">=14.17"
}
},
"packages/core": { "packages/core": {
"name": "@goauthentik/core", "name": "@goauthentik/core",
"version": "1.0.0", "version": "1.0.0",