Skip to content

Allow reopening a namespace in human-syntax schemas #1086

@cdisselkoen

Description

@cdisselkoen

Category

Cedar validation features/changes

Describe the feature you'd like to request

Allowing things like this

namespace Foo {
  entity Bar;
}
< some other declarations ... >
namespace Foo {
  entity Pancakes;
}

One motivation for this is so that concatenating valid schema fragments together produces a valid schema fragment in more cases (i.e., even when both fragments declare (different) items in the same namespace). Today, you can declare (different) items in the same namespace in different fragments, but not in the same fragment.

We cannot allow reopening namespace in the same fragment in the JSON schema syntax, because the JSON schema structure is a map from namespace name to declarations, so it would be a duplicate key in the JSON map. However, there's no reason we can't allow it in the human-readable syntax.

#1060 leaves a TODO pointing out one place that will need a code change for this.

Describe alternatives you've considered

Disallowing reopening a namespace in the same fragment, as a matter of policy. Or even more strongly, disallowing reopening a namespace in a different fragment (contrary to current behavior). However, it's not clear why we shouldn't allow this.

This is not a breaking change, but we could decide that it requires an RFC and not just this issue.

Additional context

No response

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

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestThis issue requets a substantial new featurerequires-RFCThis issue requests a substanial change to the Cedar langauge which needs to follow the RFC process

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions