Conversation
Port the server's designation validator (validateUserSchemaDesignations, internal/domain/schema_designation.go) into @zitadel/config and wire it into schemaConfigSchema, so zitadel plan, apply, and doctor reject a schema file the server would 400 on apply — with the server's own error messages, verbatim. The refine runs on the raw document, not the generated Zod's parse output: CreateSchemaBody strips unmodeled keywords (leaf `type`, root `type`, `$id`) and injects defaults, so shape is checked first via safeParse (issues re-emitted), then designations on the raw bytes — the same order as the server's schema_validator.go. Unlike the server (fail-fast), the port collects every violation; a drift-audit test pins the ported Go functions and shared message literals. Closes #1057 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
🦋 Changeset detectedLatest commit: 90f5aa0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 20 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 |
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ports the server's user-schema designation validator into
@zitadel/config, sozitadel plan,apply, anddoctorreject a schema file locally instead of lettingapplyfail with a 400 from the server.Closes #1057
What it validates
The same rules as
validateUserSchemaDesignations(internal/domain/schema_designation.go, ADR 058 §1–§2):x-identifiermust name a reachable scalar leaf carryingx-unique: "project".x-displayentry must name a reachable scalar leaf (dot-paths descend through object-shaped parents only).Error messages mirror the Go detail strings verbatim, so a user who bypasses plan sees identical text from the server. One documented divergence: the CLI collects every violation instead of failing fast.
Design notes
CreateSchemaBody's parse strips unmodeled keywords (leaftype, roottype,$id) and injects defaults, which would break the scalar-leaf checks.schemaConfigSchemais now az.custom(...).superRefinethat checks shape first viaCreateSchemaBody.safeParse(issues re-emitted), then designations on the raw document — the same order as the server'sschema_validator.go, and the server stores the raw bytes verbatim anyway.SCHEMA_DESIGNATION_RULESmaps each rule id to the Go function it ports; a test asserts those functions still exist ininternal/domain/schema_designation.goand that the shared message literals still match. Verified it fires: typoing agoReffails the audit.TestTenantSchemaValidator_UserSchemaDesignationscase for case (27 cases), plus collect-all ordering and the wiring throughschemaConfigSchema.SchemaSyncer.validatefolds the issues into the thrown message (validatePlannedFlowspattern), and doctor'sSchemaCheckrenderspath messageper issue.packages/config/defaults/default-human-user.json) already designates correctly and passes.Follow-up
Like the flow port, this is a local-first interim; the designed successor is the server-side validate-only bundle endpoint (#449).
🤖 Generated with Claude Code