fix types for Result::kind and Result::level #770
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.
This PR tweaks the
serde-sarif
build.rs
script slightly to introduce two new rewrites:Result::kind
is rewritten fromOption<serde_json::Value>
toOption<ResultKind>
Result::level
is rewritten fromOption<serde_json::Value>
toOption<ResultLevel>
This is done because the underlying code generator (
schemafy
) has only limited enum support, and fails to produce these enums (ResultKind
andResultLevel
) on its own. This library instead has its own defined versions of each, which then don't get used in the generated code.There are a handful of other places where the generated code currently uses
serde_json::Value
, but I these two are the only ones currently causing issues for me 🙂 -- I'd be happy to send a more generalized patch if desired, however.Longer term, a more general fix here might be switch from
schemafy
(which is unmaintained) totypify
, which has better enum support. I didn't attempt that in this PR, since I think it'd be a much larger undertaking.Fixes #738.