cedar-policy / cedar

Implementation of the Cedar Policy Language
https://www.cedarpolicy.com
Apache License 2.0
807 stars 68 forks source link

De-duplicate code for checking if entity types exist in schema #711

Closed john-h-kastner-aws closed 3 weeks ago

john-h-kastner-aws commented 5 months ago

Describe the improvement you'd like to request

The human-readable schema format included some duplicate checks that check for the existence of an entity type when it is used in a schema. This checks is already done when construct a ValidatorSchema object, so it shouldn't be necessary to also perform the check when parsing the schema.

Describe alternatives you've considered

No response

Additional context

No response

Is this something that you'd be interested in working on?

memark commented 3 months ago

Is this issue about refactoring out duplicate code to a common place, or to remove one of the duplicate checks altogether?

john-h-kastner-aws commented 3 months ago

It's not obvious what exactly this would entail.

The human-readable parser has to deal with issues around collisions between names for entity/builtin/extension/common types that JSON schema doesn't need to care about, so there's going to be some code exclusively used by the human schema parser. @shaobo-he-aws probably knows that relevant code best.