Skip to content

Releases: fastify/fluent-json-schema

v1.0.0

25 Apr 12:44
Compare
Choose a tag to compare

Features

  • Moved the lib to 1.0.0
  • Added FluentError (#64)

Bugs

  • Fix prop type checking (#64)
  • fixes typings for typescript usage (both CommonJS and ES6 modules) (#63)

v0.10.0

25 Apr 12:35
Compare
Choose a tag to compare

Features

  • Add S.raw (#56)
  • Improve docs (#58)

v0.9.0

02 Dec 11:33
Compare
Choose a tag to compare

Bugs

  • Drop S.extend #46 in favour of S.object().extend(baseSchema) #54

v0.8.0

22 Nov 10:39
Compare
Choose a tag to compare

Features

  • Add S.extend #46 to extend an existing schema. This allows using additionalProperties(false)

v0.7.7

15 Nov 16:28
Compare
Choose a tag to compare

Features

  • none

Bug fixes

  • Allow concatenating a prop after ifThen or ifThenElse #52

v0.7.5

26 Aug 15:53
Compare
Choose a tag to compare

Release Notes

  • AdditionalProperties accepts true as value #43
  • Export isFluentSchema property in Typescript definitions #44

v0.7.4

08 Aug 22:48
Compare
Choose a tag to compare

Features

Added a property isFluentSchema in every FluentSchema object.

const S = require('fluent-schema')
 const schema = S.object()
  .prop('foo', S.string())
  .prop('bar', S.number())
console.log(schema.isFliuentSchema) // true

The previous method based on Symbol.for('fluent-schema-object') has been deprecated but it still available

v0.7.3

22 Jun 08:47
Compare
Choose a tag to compare

Features

Added symbol to identify fluent schema objects

const S = require('fluent-schema')

const schema = S.object()
  .prop('foo', S.string())
  .prop('bar', S.number())

console.log(schema[Symbol.for('fluent-schema-object')]) // true

v0.7.2

28 May 21:36
Compare
Choose a tag to compare
  • Add readOnly and writeOnly property
S.object()
  .prop('foo', S.string().readOnly())
  .prop('bar', S.string().writeOnly(true))

v0.7.0

24 Mar 17:44
Compare
Choose a tag to compare

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