-
Notifications
You must be signed in to change notification settings - Fork 393
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
Schema type inference should take format
into account
#528
Comments
We don't take To get {
"type": "object",
"properties": {
"a": {
"format": "hostname",
"type": "string"
}
}
} Separately, we should improve type inference to select the appropriate type for common values of |
format
into account
@bcherny Thanks. The code was: {
"type": "string",
"anyOf": [
{"format": "hostname"},
{"format": "ipv6"}
]
} Changing it to this solved the problem: {
"type": "string",
"anyOf": [
{"format": "hostname", "type": "string"},
{"format": "ipv6", "type": "string"}
]
} So it looks like the type didn't get "inherited". I'm not sure if that's what should be happening? |
though, curiously, |
This resolves #18716. For whatever reason, `json-schema-to-typescript` needed `"type": "string"` in there. See bcherny/json-schema-to-typescript#528 for further discussion
This resolves #18716. For whatever reason, `json-schema-to-typescript` needed `"type": "string"` in there. See bcherny/json-schema-to-typescript#528 for further discussion
I'm not sure if support for the
ipv6
format was implemented or if it was intended to be implemented, but using astring
prop with ananyOf
[{format: 'hostname'}, {format: 'ipv6'}]
, the result isstring
and{[key: string]: unknown}
, wherehostname
converts tostring
.ipv6
should also convert tostring
.ref: appium/appium#18690
The text was updated successfully, but these errors were encountered: