Repository navigation
feat(api): add the applications contract - #2888
Conversation
Add POST /applications and GET /applications/{id}, the application.json
meta-schema that zitadel setup copies, and the application.read and
application.write scopes. The handlers return not implemented until the
server implements them.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
Deployment failed for project cloud with the following error: View Documentation: https://vercel.com/docs/accounts/team-members-and-roles |
🦋 Changeset detectedLatest commit: 970dd0d The changes in this PR will be included in the next version bump. This PR includes changesets to release 25 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
🟡 Changes recommended
Valid authenticated requests to the new application routes return HTTP 500 instead of 501, and the application schema lacks positive and negative validation tests.
1 open issue
What changed in this PR
Adds the contract for registered applications and their OAuth clients, establishing the API and editor schemas for #2788. Storage and service implementation remain follow-up work.
Changes:
- Defines create-or-revise and read operations, client identity rules, and one-time secret responses.
- Generates Go client/server bindings and exposes the application meta-schema through configuration tooling.
- Adds application scopes, permission documentation, and release notes.
| File | Description |
|---|---|
packages/go/api/oas_validators_gen.go |
Adds application and client validation. |
packages/go/api/oas_security_gen.go |
Maps application operation scopes. |
packages/go/api/oas_schemas_gen.go |
Adds application request and response types. |
packages/go/api/oas_response_decoders_gen.go |
Decodes application responses. |
packages/go/api/oas_request_encoders_gen.go |
Encodes application creation requests. |
packages/go/api/oas_parameters_gen.go |
Adds project and application parameters. |
packages/go/api/oas_operations_gen.go |
Adds application operation names. |
packages/go/api/oas_interfaces_gen.go |
Adds application response interfaces. |
packages/go/api/oas_client_gen.go |
Adds Go client methods. |
packages/go/api/oas_cfg_gen.go |
Adds the client ID validation pattern. |
packages/config/src/meta-schemas.ts |
Exposes the application editor schema. |
packages/config/src/meta-schemas.test.ts |
Checks application schema inclusion. |
docs/design/api/system-permission-catalog.md |
Documents application permissions and revision semantics. |
apps/cli/tests/unit/commands/api-coverage.test.ts |
Exempts applications pending CLI support. |
apps/api/internal/api/generated/oas_validators_gen.go |
Adds server-side schema validation. |
apps/api/internal/api/generated/oas_unimplemented_gen.go |
Adds placeholder application handlers. |
apps/api/internal/api/generated/oas_server_gen.go |
Extends the server handler interface. |
apps/api/internal/api/generated/oas_security_gen.go |
Maps server operation scopes. |
apps/api/internal/api/generated/oas_response_encoders_gen.go |
Encodes application responses. |
apps/api/internal/api/generated/oas_request_decoders_gen.go |
Decodes application creation requests. |
apps/api/internal/api/generated/oas_parameters_gen.go |
Decodes application route parameters. |
apps/api/internal/api/generated/oas_operations_gen.go |
Adds server operation names. |
apps/api/internal/api/generated/oas_interfaces_gen.go |
Adds server response interfaces. |
apps/api/internal/api/generated/oas_handlers_gen.go |
Adds application request handling pipelines. |
apps/api/internal/api/generated/oas_cfg_gen.go |
Adds server client ID validation pattern. |
apps/api/api/openapi/security/oauth2.yaml |
Declares application read/write scopes. |
apps/api/api/openapi/openapi-spec.yaml |
Registers application tags and paths. |
apps/api/api/openapi/endpoints/schemas/application.yaml |
Defines the application document. |
apps/api/api/openapi/endpoints/schemas/application.json |
Generates the application JSON Schema. |
apps/api/api/openapi/endpoints/schemas/application-client.yaml |
Defines OAuth client settings and identity rules. |
apps/api/api/openapi/endpoints/applications/methods.yaml |
Defines create-or-revise behavior and examples. |
apps/api/api/openapi/endpoints/applications/createApplication-error-response.yaml |
Generates creation error responses. |
apps/api/api/openapi/endpoints/applications/create-application-response.yaml |
Defines write responses with one-time secrets. |
apps/api/api/openapi/endpoints/applications/create-application-request.yaml |
Defines the application request envelope. |
apps/api/api/openapi/endpoints/applications/by_id/methods.yaml |
Defines reading the latest revision. |
apps/api/api/openapi/endpoints/applications/by_id/getApplicationById-error-response.yaml |
Generates read error responses. |
apps/api/api/openapi/endpoints/applications/application-response.yaml |
Defines secret-free read responses. |
apps/api/api/openapi/endpoints/applications/application-client-secret.yaml |
Defines one-time client secret payloads. |
apps/api/api/openapi/components/parameters/application-id.yaml |
Defines the application path parameter. |
apps/api/api/openapi/bundled/openapi.json |
Bundles the new application contract. |
.changeset/applications-api-contract.md |
Records server and configuration releases. |
Review effort: Balanced
| "auth-method.json", | ||
| "sso-auth-method.json", | ||
| "idp-connection.json", | ||
| "application.json", |
There was a problem hiding this comment.
The schema's only consumer in this PR is the server, which validates documents against it in the service PR. That is where a negative case first has behavior to protect, so the Ajv cases come with that PR.
Removing a client waits for the deletion design, so a revision that omits a stored client is refused instead of leaving a retired row behind. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Qualify the client_ ban to new clients, require authorization_code with refresh_token, make redirect_uris the home of the redirect rule, compose the create response over the application response, add the docs tag page, register the prefixes in ADR 047 and name @zitadel/cli in the changeset. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
A retry after a lost response finds the clients stored and gets no secret, so the key lets the retry return the first response. The editor schema leaves .zitadel/meta/ until a command reads application files, the document is the application field of the body, and the query is listed as not yet exposed. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Context
Summary
The first of three PRs for #2788. It adds the contract for registered
applications and their OAuth clients; domain and storage, then service and
API, follow in their own PRs.
POST /applicationscreates or revises a registered application by slug,and
GET /applications/{id}reads one at its newest revision. Theoperations have no handler until the service PR; a request to them answers
500 today.
application.jsonis the schema the server validates the documentagainst. It stays out of
.zitadel/meta/until a command readsapplication files (Applications: declared applications in releases #2790).
client_secretswith the client's slug andclient_id. The get responsenever carries one. An
Idempotency-Keylets a retry after a lost responseget the first response, secrets included.
client_idacross revisions; a changed id is refusedwith
application.field_immutable, a reused id withapplication.client_id_taken. A revision cannot remove a client; removalcomes with deletion.
application.readandapplication.write, and the permissioncatalog rows for them.
app,apprevandclientprefixes in ADR 047.Validation
moon run server:generatemoon run server:openapi(0 errors, 1 pre-existing warning)cd apps/api && go build ./... && go test ./internal/api/ ./api/...moon run config:testmoon run workspace:check -- --only releaseon Node 24 (CLI tests: 371 files, 6580 tests passed)Release notes / changeset
Changeset:
.changeset/applications-api-contract.md—@zitadel/serverand@zitadel/configminor: the applications contract.Notes
localhost, names underit and loopback IPs count as loopback hosts for
httpredirect URIs.client_/dcr_prefix ban on a suppliedclient_idis a domain rulein the next PR, so the schema pattern accepts server-generated ids.
oas_json_gen.goare alphabetical insertion:Application*types sort before theAtt*error types.application.*error codes named here (field_immutable,client_id_taken,invalid) get their domain sentinels and generatedschemas in the domain PR, as the idps contract did in feat(idp): define the connection API #1217.
${{ NAME }}secretreference ADR 082 §3 puts in
.zitadel/applications/<slug>.jsoncomes withthe release build in Applications: declared applications in releases #2790;
POST /applicationsreturns server-generatedsecrets once in
client_secrets.client_idis a column of the client row, not its key. A supplied id, a v4<id>@<project>or one the CLI generated, is caller-chosen and nottime-sortable, which ADR 047 §4 keeps out of primary keys; the row has a
minted key and ADR 047 §5 records the rule.
getApplicationByIdtakes the project secret only. The session cookiecomes with the console screen, as it did for the sibling reads.
/applications,application.json, a caller-suppliableclient_id,first_partyperclient); ADR 082 on main still describes
/apps. Merge order: docs: bring ADR 082 in line with the identity model and accept it #2864 first.🤖 Generated with Claude Code