diff --git a/tests/mocks/jsonchema_defs.json b/tests/mocks/jsonchema_defs.json new file mode 100644 index 0000000..ef79c1a --- /dev/null +++ b/tests/mocks/jsonchema_defs.json @@ -0,0 +1,23 @@ +{ + "$id": "https://example.com/schemas/customer", + "type": "object", + "properties": { + "first_name": { + "$ref": "#/$defs/name" + }, + "last_name": { + "$ref": "#/$defs/name" + } + }, + "required": [ + "first_name", + "last_name", + "shipping_address", + "billing_address" + ], + "$defs": { + "name": { + "type": "string" + } + } +} diff --git a/tests/smoke.t b/tests/smoke.t index f7eb263..a73a6c8 100644 --- a/tests/smoke.t +++ b/tests/smoke.t @@ -43,3 +43,14 @@ Generate ATD out of OpenAPI doc with -f attribute type product = { ?productId: int option; } + +Generate ATD out of JSON Schema that contains defs + $ jsonschema2atd --format=jsonschema ./mocks/jsonchema_defs.json + (* Generated by jsonschema2atd *) + type json = abstract + type int64 = int + + type root = { + first_name: name; + last_name: name; + }