You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A float32 in a oneOf with a nullable type can lead to syntax errors #2636
(This is also something that could be classed as a "spec issue", but outputting the literal <nil> is a syntax error either way, so we should harden this)
Yeah, I can see how this happens. We don't have an understanding of types, it's just type generation heuristics in the code, and that is a very, very weird construct.
It looks like you want this number to be either 0, 1 to 1000, or null.
wouldn't something like this be better and clearer?
max_credits_per_run:
type: number
minimum: 0
maximum: 1000
nullable: true
I've been thinking for some time of coming up with a preprocessing pass on the spec, to convert it into a more canonical format, before actually running codegen, which would greatly simplify the codegen and move the special casing logic to its own module.
We can certainly detect this special case; if all the branches in a oneOf are the same type, but the differences are the constraints, then we convert it to the top level type and just set the constraints directly. I'm always on the fence about how much we go out of our way to read ugly specs.
Activity
jamietanna commentedon Oct 27, 2026
(This is also something that could be classed as a "spec issue", but outputting the literal
<nil>is a syntax error either way, so we should harden this)mromaszewicz commentedon Oct 27, 2026
Yeah, I can see how this happens. We don't have an understanding of types, it's just type generation heuristics in the code, and that is a very, very weird construct.
It looks like you want this number to be either 0, 1 to 1000, or null.
wouldn't something like this be better and clearer?
I've been thinking for some time of coming up with a preprocessing pass on the spec, to convert it into a more canonical format, before actually running codegen, which would greatly simplify the codegen and move the special casing logic to its own module.
We can certainly detect this special case; if all the branches in a
oneOfare the same type, but the differences are the constraints, then we convert it to the top level type and just set the constraints directly. I'm always on the fence about how much we go out of our way to read ugly specs.fix: skip null members of non-string enums (#2654)