oxidecomputer / oxidecomputer/typify
Translate `if`/`then`/`else` to `oneOf`
Open
Nobody has claimed this yet.
if/then
- Dominant language
- Rust
- Stars
- 898
- Forks
- 114
- Avg merge
- 4h 18m
- Merged PRs (30d)
- 14
Description
Right now we don't support the if/then/else structure. I think it would be valid to transform it to a oneOf:
{
"if": { "$ref": "#/$defs/A" },
"then": { "$ref": "#/$defs/B" },
"else": { "$ref": "#/$defs/C" },
}
transforms to
{
"oneOf": [
{
"title": "then",
"allOf": [
{ "$ref": "#/$defs/A" },
{ "$ref": "#/$defs/B" }
]
},
{
"title": "else",
"allOf": [
{ "not": { "$ref": "#/$defs/A" } },
{ "$ref": "#/$defs/C" }
]
}
]
}
This should become something like:
#[serde(untagged)]
pub enum IfThenElseType {
Then(BA),
Else(CNotA),
}
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
The issue names no files or tests. Start by tracing existing oneOf handling in the JSON Schema-to-Rust compiler, then check whether the proposed if/then/else transformation preserves the conditional schema semantics. Done means supporting the structure and generating the corresponding untagged Rust enum representation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- json, rust
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100