anttiviljami / mock-json-schema

Simple utility to mock example objects based on JSON schema definitions
https://www.npmjs.com/package/mock-json-schema
MIT License
26 stars 4 forks source link

[question]: is it possible to mock self referencing? #21

Open javaxiu opened 1 year ago

javaxiu commented 1 year ago

a self referencing json schema like this, can mock-json-schema mock this?

{
  "type": "object",
  "properties": {
    "name": { "type": "string" },
    "tree": { "$ref": "#/definitions/tree" }
  },
  "definitions": {
    "tree": {
      "type": "object",
      "properties": {
        "value": { "type": "string" },
        "branches": {
          "type": "array",
          "items": { "$ref": "#/definitions/tree" },
          "minItems": 1
        }
      },
      "required": ["value"]
    }
  }
}
anttiviljami commented 11 months ago

At the moment recursive mocking is not supported. PRs accepted!