Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typed string enums #107

Merged
merged 4 commits into from
Nov 15, 2024
Merged

Typed string enums #107

merged 4 commits into from
Nov 15, 2024

Conversation

jaredoconnell
Copy link
Contributor

Changes introduced with this PR

This fixes a problem that Thibault from product security encountered while trying to add support for Kubernetes resourcelist with the type ResourceName.

In Golang it's possible to alias a type or create a new type that inherits things from another type. This fixes when the latter is used. Reflection was required as the Golang type setup is strict about typing.

This is done in a generic way that will enable the same setup for int enums in the future if desired.


By contributing to this repository, I agree to the contribution guidelines.

schema/enum_string_test.go Outdated Show resolved Hide resolved
schema/testdata/test_data.go Show resolved Hide resolved
schema/map_test.go Outdated Show resolved Hide resolved
schema/map_test.go Show resolved Hide resolved
schema/testdata/test_data.go Show resolved Hide resolved
schema/map_test.go Show resolved Hide resolved
@jaredoconnell jaredoconnell merged commit 2b68585 into main Nov 15, 2024
3 checks passed
@jaredoconnell jaredoconnell deleted the typed-string-enums branch November 15, 2024 16:26
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