json-schema-faker / json-schema-faker

JSON-Schema + fake data generators

Home Page:http://json-schema-faker.js.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to support v3

robjens opened this issue · comments

commented

Ok it's not 'really' v3 support but good enough for my use case and works like a charm.

So just a minor tip here, in case anyone would want to use JSON Schema v3 (I want to mock up our RAML API schemas and those are only v3 as of yet).

There is an easy way to do this, the steps to take would be:

  1. npm i json-schema-compatibility
  2. read schema file(s) using any (a)sync method you like
  3. parse each file buffer -> string and apply JSON.parse to the result
  4. use the compat.v4 method and apply it on 3
  5. delete the '$schema' key from the variable holding 4

The json-schema-faker dependency normalizr (I recall) stops complaining.

Hi @robjens! Sorry to reply so late. This post is not really an issue, it seems to be an instruction on what to do in order to achieve v3 support. I would like to include your work into the project.

First I was thinking of implementing it, but it's using some 3rd party tools and the problem seems to be an edge case. So I think we could just include it into the documentation (README.md file). But in order to do that, I'd ask you to provide some more information about that, i.e.

  • what do you need the json-schema-compatibility for?
  • some code snippets?
  • a working gist or anything we could see this in action?

And how about the RAML API schemas - do they still support v3 only?

This won't be fixed on JSF, of course we need to add documentation about this topic.