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

oneOf with boolean offers implicit bool conversion #536

Open
idg10 opened this issue Jan 9, 2025 · 0 comments
Open

oneOf with boolean offers implicit bool conversion #536

idg10 opened this issue Jan 9, 2025 · 0 comments

Comments

@idg10
Copy link
Contributor

idg10 commented Jan 9, 2025

We have this type:

    "stringOrIsAvailable": {
      "oneOf": [
        { "type": "boolean" },
        { "type": "string" }
      ]
    },

(In the original context, the first type was actually { "$ref": "#/$defs/isAvailable" }, but isAvailable is just {"type":"boolean"}

The generated code defines an implicit conversion to bool, which fails with an InvalidOperationException if it's not a boolean. We were expecting this to be an explicit conversion.

@idg10 idg10 added the bug label Jan 9, 2025
@mwadams mwadams removed the bug label Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants