GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together. Use JSON Schema along with fake generators to provide consistent and meaningful fake data for your system. We are looking for contributors! If you wanna help us make jsf more awesome, simply write us so! A release candidate for v0.
Until a polished v0. You can save your schemas online and share the link with your collaborators. JSON-Schema-faker is also available at cdnjs. This means you can just include the script file into your HTML:.
It will be fetched from the Content Delivery Network without installing any node. You can see an example JS fiddle based on jsf loaded from cdnjs. Use angular-jsf module installable via npm and bower to get jsf working in your angular app out of the box! And check out angular-jsf demo. Use grunt-jsonschema-faker to automate running json-schema-faker against your JSON schemas.
Use json-schema-faker-cli to run jsf from your command line. Use json-schema-faker-loader to execute jsf as a webpack loader. If you want to use draft , you may find useful information here. Inline references are fully supported json-pointers but external can't be resolved by jsf. Remote en local references are automatically resolved thanks to json-schema-ref-parser. Local references are always resolved from the process.
The above schema will invoke faker. In following inline code examples the faker and chance variables are assumed to be created with, respectively:. This example works for single-parameter generator function. However, if you pass multiple arguments to the generator function, just pass them wrapped in an array. In the example below we use the faker. We just wrap them with an array and it's equivalent to faker.
However, if you want to pass a single parameter that is an array itself, e. The outer brackets determine that the content is gonna be a list of params injected into the generator.
The inner brackets are just the value itself - the array we pass:. You can also extend Chance. The first parameter of extend function is the generator name faker , chance , etc. The second one is the function that must return the dependency library. But since jsf uses the type property to create the proper fake data, we attempt to infer the type whenever it is not provided. Now this means that if you do not use any of the JSON Schema validation properties, jsf will not be able to infer the type for you and you will need to explicitly set your type manually.
In order to execute jsf in a browser, you should include the distribution file from dist directory. Each new version of jsf is bundled using Rollup.
The bundle includes full versions of all dependencies. We are more than happy to welcome new contributors, our project is heavily developed, but we need more power: Please see contribution guide , you can always contact us to ask how you can help. If you want to contribute, take a look at the technical documentation page. You may find some important information there making it easier to start. Moreover, if you find something unclear e.
There were some existing projects or services trying to achieve similar goals as jsf:. That's why jsf was created. Permalink Failed to load latest commit information. You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Update URI formats Allow for nested arrays. Include dist on npm Test on 8; build before testing on CI. Merge branch 'master' into develop.More...