Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for an x-format property #42

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ajfisher
Copy link

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

@subeeshcbabu-zz
Copy link
Owner

Thanks for the PR.

  • Can you fix the lint errors.
  • Can you update the Readme with the x-format option and the Current of supported formats (firstname and lastname).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants