Skip to content

Commit

Permalink
tests: add json schema with defs
Browse files Browse the repository at this point in the history
  • Loading branch information
Khady committed Feb 27, 2024
1 parent f5cae1c commit 1bdb379
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/mocks/jsonchema_defs.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
11 changes: 11 additions & 0 deletions tests/smoke.t
Original file line number Diff line number Diff line change
Expand Up @@ -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 <ocaml module="Yojson.Basic" t="t"> = abstract
type int64 = int <ocaml repr="int64">

type root = {
first_name: name;
last_name: name;
}

0 comments on commit 1bdb379

Please sign in to comment.