Skip to content

Add Schema parsing, programmatic creation, and resolution#129

Merged
philhassey merged 14 commits intocedar-policy:mainfrom
strongdm:patjak/schema
Feb 10, 2026
Merged

Add Schema parsing, programmatic creation, and resolution#129
philhassey merged 14 commits intocedar-policy:mainfrom
strongdm:patjak/schema

Conversation

@philhassey
Copy link
Copy Markdown
Contributor

@philhassey philhassey commented Feb 10, 2026

This PR continues support for human schema and JSON parsing and marshaling of Cedar schemas. In addition there is a programmatic AST for manually creating a schema or modifying one that was parsed. Lastly it adds experimental resolution of the AST.

This still lives in x/exp/schema for now, but we expect to promote it to a non-x/exp package in the future.

patjakdev and others added 14 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>
…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>
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>
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>
@philhassey philhassey merged commit 682b8a0 into cedar-policy: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