Skip to content

chore: update manifest validation to enforce unique flag keys #193

@kriscoleman

Description

@kriscoleman

Description

Our validation command currently does not check if the flag keys in the manifest are unique. If we implement that there, it will be checked across all cli commands.

Context from PR

From #191 discussion:

Do we need to handle the case where the flag being deleted exists more than once in the manifest? Or is that impossible?

It is handled in our add command:

return fmt.Errorf("flag '%s' already exists in the manifest", flagName)

However, it might be worth adding it to our Validate func. That's used by manifest.LoadFlagSet, which is called by all of our commands to load the flag set.

func Validate(data []byte) ([]ValidationError, error) {

https://github.com/search?q=repo%3Aopen-feature%2Fcli%20manifest.LoadFlagSet&type=code

This way, if someone adds the flag manually by editing the json for instance, the next usage of the cli against the manifest would throw invalidation errors immediately.

I would support that, but suggest in another PR for hygiene.

Originally posted by @kriscoleman in #191 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions