Skip to content

schema: create a public schema parser and programmatic construction i…#16

Merged
patjakdev merged 14 commits intomainfrom
patjak/schema
Feb 10, 2026
Merged

schema: create a public schema parser and programmatic construction i…#16
patjakdev merged 14 commits intomainfrom
patjak/schema

Conversation

@philhassey
Copy link

…mplementation

@patjakdev patjakdev force-pushed the patjak/schema branch 6 times, most recently from ce32799 to a77dfd9 Compare February 9, 2026 18:30
patjakdev and others added 3 commits February 9, 2026 10:32
…mplementation

Replaces the experimental schema package (x/exp/schema) and the internal
schema parser, AST, and token packages with a new public schema API. The new
schema package (schema/) supports parsing and marshaling Cedar schemas in both
the human-readable (.cedarschema) and JSON formats, programmatic AST
construction via schema/ast, and type resolution via schema/resolved. The
resolver fully qualifies entity types, inlines common type references, and
indexes all declarations by their qualified names, making the resolved schema
directly usable for validation and tooling.

Key structural changes: the schema AST now lives in schema/ast with a cleaner
type hierarchy (IsType sum type, EntityTypeRef, TypeRef, RecordType, etc.),
the parser and JSON codec are internal (schema/internal/parser and
schema/internal/json), and the top-level schema.Schema type provides
UnmarshalCedar, MarshalCedar, UnmarshalJSON, MarshalJSON, and Resolve methods
as the primary public interface. The previous experimental 1.2.5 changelog
entry is removed as this functionality is now stable.

Signed-Off-By: Patrick Jakubowski <patrick.jakubowski@strongdm.com>
Signed-off-by: Phil Hassey <phil@strongdm.com>
Signed-Off-By: Patrick Jakubowski <patrick.jakubowski@strongdm.com>
… two

Signed-Off-By: Patrick Jakubowski <patrick.jakubowski@strongdm.com>
Signed-Off-By: Patrick Jakubowski <patrick.jakubowski@strongdm.com>
Copy link

@patjakdev patjakdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure that the sumtype linter is actually doing something here...

(it turns out that go-check-sumtype's integration with golangci-lint means it can only check intra-package, which is pretty lame. I changed the CI so that it installs the standalone tool and runs it instead).

…e fact that the key should be unqualified

Signed-Off-By: Patrick Jakubowski <patrick.jakubowski@strongdm.com>
Signed-Off-By: Patrick Jakubowski <patrick.jakubowski@strongdm.com>
@patjakdev patjakdev force-pushed the patjak/schema branch 2 times, most recently from 576fff5 to b8396f3 Compare February 9, 2026 23:06
patjakdev and others added 3 commits February 9, 2026 15:09
Signed-Off-By: Patrick Jakubowski <patrick.jakubowski@strongdm.com>
Signed-off-by: Phil Hassey <phil@strongdm.com>
Signed-off-by: Phil Hassey <phil@strongdm.com>
@patjakdev patjakdev force-pushed the patjak/schema branch 2 times, most recently from 5ad4916 to c266436 Compare February 10, 2026 00:10
When running go-check-sumtype in golangci-lint, sum types can only be checked in the package in which they're defined (see golangci/golangci-lint#4158). Bummer.

This change makes it so that we now run the linter explicitly in CI.

Signed-Off-By: Patrick Jakubowski <patrick.jakubowski@strongdm.com>
Signed-off-by: Phil Hassey <phil@strongdm.com>
Signed-off-by: Phil Hassey <phil@strongdm.com>
…ed more than once

Signed-off-by: Phil Hassey <phil@strongdm.com>
@patjakdev patjakdev merged commit 682b8a0 into main Feb 10, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants