Recursively convert a traversable schema into its JSON schema representation.
Roundtrip property:
Thoroughly tested using randomly generated schemas to be invertible with
fromJsonSchema without any loss of information.
Note: If you find yourself reaching for toJsonSchema,
keep in mind that by installing the @traversable/schema-to-json-schema package,
all of the built-in schemas from the @traversable/schema package come
equipped with a .toJsonSchema getter method.
Prefer using the .toJsonSchema method if possible -- not only is it
easier to use, but it's also more performant, since the implementation
is not recursive.
toJsonSchema
Recursively convert a traversable schema into its JSON schema representation.
Roundtrip property:
Thoroughly tested using randomly generated schemas to be invertible with
fromJsonSchema
without any loss of information.Note: If you find yourself reaching for
toJsonSchema
, keep in mind that by installing the@traversable/schema-to-json-schema
package, all of the built-in schemas from the@traversable/schema
package come equipped with a.toJsonSchema
getter method.Prefer using the
.toJsonSchema
method if possible -- not only is it easier to use, but it's also more performant, since the implementation is not recursive.