Skip to content
Snippets Groups Projects
Commit 699eac1b authored by Alvaro Cabrera's avatar Alvaro Cabrera
Browse files

Missing info; fixed

parent b8767093
No related branches found
No related tags found
No related merge requests found
...@@ -49,7 +49,7 @@ Supported keywords ...@@ -49,7 +49,7 @@ Supported keywords
- **$ref** — Resolve internal references only, and/or external if provided. - **$ref** — Resolve internal references only, and/or external if provided.
- **required** — All required properties are guaranteed, if not can be omitted. - **required** — All required properties are guaranteed, if not can be omitted.
- **pattern** - **pattern** — Generate samples based on RegExp values.
- **format** — Core formats only: date-time, email, hostname, ipv4, ipv6 and uri. - **format** — Core formats only: date-time, email, hostname, ipv4, ipv6 and uri.
- **enum** — Returns any of these enumerated values. - **enum** — Returns any of these enumerated values.
- **minLength/maxLength** — Applies length constraints to string values. - **minLength/maxLength** — Applies length constraints to string values.
...@@ -67,10 +67,41 @@ Supported keywords ...@@ -67,10 +67,41 @@ Supported keywords
- **additionalProperties** — Partially supported (?) - **additionalProperties** — Partially supported (?)
- **dependencies** — Not supported yet (?) - **dependencies** — Not supported yet (?)
Using references
----------------
Inline references are fully supported (json-pointers) but external can't be resolved by `json-schema-faker`.
In order to achieve that you can use [refaker](https://github.com/gextech/refaker) and then use the resolved schemas:
```javascript
var schema = {
type: 'object',
properties: {
someValue: {
$ref: 'otherSchema'
}
}
};
var refs = [
{
id: 'otherSchema',
type: 'string'
}
];
var sample = jsf(schema, refs);
console.log(sample.someValue);
// output: voluptatem
```
Faking values Faking values
------------- -------------
In order to get human-friendly samples you can use the **faker** property on each subschema: Generated human-friendly samples by using **faker** property on each subschema:
```json ```json
{ {
...@@ -100,3 +131,8 @@ Actually, I've found some projects or services: ...@@ -100,3 +131,8 @@ Actually, I've found some projects or services:
- https://github.com/murgatroid99/json-schema-random-instance - https://github.com/murgatroid99/json-schema-random-instance
But are incomplete or has limited support for some keywords, so I decided to code this library. But are incomplete or has limited support for some keywords, so I decided to code this library.
Issues
------
Any contribution is well received.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment