As chance.js is being used, the scope of the type of data that can be mocked is more than the "common" formats used informally by the swagger spec.
Rather than confuse this, I've used an extension to the property as x-format which can be used to provide format hinting.
For the moment this is limited to firstname and lastname which does the appropriate mapping to chance.js however this could be extended to deal with things like place data etc to comprise the wider set of data chance.js can create.
example property definition:
person:
type: object
properties:
id:
type: string
format: uuid
description: UUIDv4 for the specific person
email:
type: string
format: email
description: email address for the person
phone:
type: string
format: phone
first_name:
type: string
x-format: firstname
description: Name of the person
last_name:
type: string
x-format: lastname
As chance.js is being used, the scope of the type of data that can be mocked is more than the "common" formats used informally by the swagger spec.
Rather than confuse this, I've used an extension to the property as
x-format
which can be used to provide format hinting.For the moment this is limited to
firstname
andlastname
which does the appropriate mapping to chance.js however this could be extended to deal with things like place data etc to comprise the wider set of data chance.js can create.example property definition: