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
I've been working with json_schema$serialise() recently, and I'm seeing that when I attempt to serialise an object using a composed/cobined schema (anything using $ref), the returned values are always arrays.
schema<-'{ "$schema": "http://json-schema.org/draft-04/schema#", "definitions": { "city": { "type": "string" } }, "type": "object", "properties": { "city": { "$ref": "#/definitions/city" } }}'validator<-jsonvalidate::json_schema$new(schema)
out<-validator$serialise(list(city="Firenze"))
print(out)
#> {"city":["Firenze"]}validator$validate(out, verbose=TRUE)
#> [1] FALSE#> attr(,"errors")#> instancePath schemaPath keyword type message schema#> 1 /city #/definitions/city/type type string must be string string#> type data dataPath#> 1 string Firenze /city
The example above is a reprex, but I see the same behavior for definitions defined in separate files ("$ref": "x.json") as well. at a first guess, this seems like the sub-schemas aren't propagating auto_unbox, but I'm out of my depth on JS/V8.
The text was updated successfully, but these errors were encountered:
Hi,
I've been working with
json_schema$serialise()
recently, and I'm seeing that when I attempt to serialise an object using a composed/cobined schema (anything using$ref
), the returned values are always arrays.Created on 2024-01-15 with reprex v2.0.2
Session info
The example above is a reprex, but I see the same behavior for definitions defined in separate files (
"$ref": "x.json"
) as well. at a first guess, this seems like the sub-schemas aren't propagatingauto_unbox
, but I'm out of my depth on JS/V8.The text was updated successfully, but these errors were encountered: