Skip to content

v0.7.0

Choose a tag to compare

@aboutlo aboutlo released this 24 Mar 17:44

Removed type string as the default value when a prop is created

S.object().prop('foo')

was generating this schema:

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "properties": {
    "foo": {
       "type": "string",
    }
  }
}

now it returns this one:

{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "type": "object",
  "properties": {
    "foo": {}
  }
}

which is correct because a prop without a type accepts any, not a string

Updated the basic example showing how to inject constants in a schema