Add #[schema(skip)] option for enum variants#1513
Open
notNotDaniel wants to merge 1 commit intojuhaku:masterfrom
Open
Add #[schema(skip)] option for enum variants#1513notNotDaniel wants to merge 1 commit intojuhaku:masterfrom
notNotDaniel wants to merge 1 commit intojuhaku:masterfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a new
#[schema(skip)]option which can be used to filter out enum variants before deciding if the set of variants is mixed or composed only ofUnitvalues. We need this to support our use case, where we have enums with a set of known values, but also want to capture a singleUnknown(String)value using#[serde(untagged)], but need the resulting openApi documentation to include just a simple list of enum values.I had hoped to reuse the existing
ignorefeature, however since the filtering needs to happen during the schema generation (but not rust code generation), it wasn't clear how the expression included withignorecould be evaluated, and the simpleskipoption matches nicely with the serdeskipoption.