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

Support fallback key in enum schema specification #256

Open
thejeff77 opened this issue Dec 7, 2023 · 1 comment
Open

Support fallback key in enum schema specification #256

thejeff77 opened this issue Dec 7, 2023 · 1 comment
Labels
enhancement New feature or request

Comments

@thejeff77
Copy link

Hey team,

I wrote up a OAPI schema proposal for fallback enum values.. Since you guys are active and this would be pushed forward by a reference to an existing implementation, what would you think about helping out and supporting this option in fabrikt? Is it even possible?

Thanks for any consideration!

@cjbooms
Copy link
Owner

cjbooms commented Dec 12, 2023

What about supporting this as a generation option for ENUMs, with a hard-coded fallback string for all unmapped enums. eg, something like:

"--http-model-opts", "ENABLE_ENUM_FALLBACK"
"--http-model-opts", "FAULT_TOLERANT_ENUMS"
"--fault-tolerant-enum-fallback", "NOT_MAPPED"
"--enum-unknown-fallback", "NOT_MAPPED"

It's worth pointing out that at Zalando, we use x-extensible-enum which should be treated by:

  • clients as plain strings
  • servers as enums using: "--http-model-opts", "X_EXTENSIBLE_ENUMS"

But I like your solution quite a lot, as it allows clients to benefit from type safe enums, without risking exceptions

@averabaq averabaq added the enhancement New feature or request label Feb 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants