From 5a556088368f55b9576b3f293e2a82449956b5fe Mon Sep 17 00:00:00 2001 From: Anjan Kaur <ankaur@anjansmacbook.corp.adobe.com> Date: Fri, 29 Mar 2019 14:54:47 +0530 Subject: [PATCH] Adding tests and fixing examples --- examples/docs/definitions.schema.md | 4 ++-- examples/generated-schemas/definitions.schema.json | 5 ++++- examples/schemas/definitions.schema.json | 3 ++- spec/examples/definitions.schema.md | 4 ++-- spec/lib/integrationTest.spec.js | 1 + 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/examples/docs/definitions.schema.md b/examples/docs/definitions.schema.md index 556bf88..5a8bebe 100644 --- a/examples/docs/definitions.schema.md +++ b/examples/docs/definitions.schema.md @@ -36,7 +36,7 @@ aks. | Property | Type | Required | Nullable | Defined by | |----------|------|----------|----------|------------| -| [@id](#id) | `string` | Optional | No | Definitions (this schema) | +| [@id](#id) | `string` | **Required** | No | Definitions (this schema) | | [id](#id-1) | `string` | **Required** | No | Definitions (this schema) | | [meta:id](#metaid) | `string` | Optional | No | Definitions (this schema) | | `*` | any | Additional | Yes | this schema *allows* additional properties | @@ -47,7 +47,7 @@ An `id` with an `@` in front of it. The `@` stands for "dot com" `@id` -* is optional +* is **required** * type: `string` * defined in this schema diff --git a/examples/generated-schemas/definitions.schema.json b/examples/generated-schemas/definitions.schema.json index 6ce74a0..4db4882 100644 --- a/examples/generated-schemas/definitions.schema.json +++ b/examples/generated-schemas/definitions.schema.json @@ -27,7 +27,10 @@ "format": "email", "description": "An about ids. It is meta. If you are confused, send an email to the address specified in this property value." } - } + }, + "required": [ + "@id" + ] } }, "allOf": [ diff --git a/examples/schemas/definitions.schema.json b/examples/schemas/definitions.schema.json index fb7623a..0141419 100644 --- a/examples/schemas/definitions.schema.json +++ b/examples/schemas/definitions.schema.json @@ -27,7 +27,8 @@ "format": "email", "description": "An about ids. It is meta. If you are confused, send an email to the address specified in this property value." } - } + }, + "required": ["@id"] } }, "allOf": [ diff --git a/spec/examples/definitions.schema.md b/spec/examples/definitions.schema.md index 556bf88..5a8bebe 100644 --- a/spec/examples/definitions.schema.md +++ b/spec/examples/definitions.schema.md @@ -36,7 +36,7 @@ aks. | Property | Type | Required | Nullable | Defined by | |----------|------|----------|----------|------------| -| [@id](#id) | `string` | Optional | No | Definitions (this schema) | +| [@id](#id) | `string` | **Required** | No | Definitions (this schema) | | [id](#id-1) | `string` | **Required** | No | Definitions (this schema) | | [meta:id](#metaid) | `string` | Optional | No | Definitions (this schema) | | `*` | any | Additional | Yes | this schema *allows* additional properties | @@ -47,7 +47,7 @@ An `id` with an `@` in front of it. The `@` stands for "dot com" `@id` -* is optional +* is **required** * type: `string` * defined in this schema diff --git a/spec/lib/integrationTest.spec.js b/spec/lib/integrationTest.spec.js index 8ed4797..575a13e 100644 --- a/spec/lib/integrationTest.spec.js +++ b/spec/lib/integrationTest.spec.js @@ -57,6 +57,7 @@ describe('Compare results', () => { const files = readdirSync('./spec/examples').filter(item => !(/(^|\/)\.[^\/\.]/g).test(item)); expect(files.length).toEqual(22); + //console.log(readFileSync(path.resolve('./examples/schemas/', 'definitions.schema.json')).toString()); files.forEach(file => { if (statSync('./spec/examples/' + file).isFile()) { const expectedstr = readFileSync(path.resolve('./spec/examples/', file)).toString(); -- GitLab