Skip to content

Commit

Permalink
Merge pull request #214 from FadySalama/develop
Browse files Browse the repository at this point in the history
upgrade ajv, add ajv-formats, update all schemas to version 0.7
  • Loading branch information
egekorkan authored Dec 5, 2021
2 parents 677876c + d9d0fb0 commit a125e2e
Show file tree
Hide file tree
Showing 174 changed files with 8,375 additions and 6,599 deletions.
107 changes: 78 additions & 29 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions packages/assertions/assertionTests.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ const isUtf8 = require('is-utf8')

// The usual library used for validation
const Ajv = require('ajv')
const addFormats = require("ajv-formats")


// Imports from playground core
const checkUniqueness = require('@thing-description-playground/core').propUniqueness
Expand Down Expand Up @@ -86,6 +88,9 @@ function validate(tdData, assertions, manualAssertions, logFunc) {
}
const ajv = new Ajv(ajvOptions)
ajv.addSchema(schema, 'td')
ajv.addVocabulary(['is-complex', 'also']);
addFormats(ajv)



const valid = ajv.validate('td', tdJson)
Expand Down Expand Up @@ -261,6 +266,8 @@ function checkVocabulary(tdJson) {
const results = []
const ajv = new Ajv()
ajv.addSchema(tdSchema, 'td')
ajv.addVocabulary(['is-complex', 'also']);
addFormats(ajv)

const valid = ajv.validate('td', tdJson)
const otherAssertions = ["td-objects_securityDefinitions", "td-arrays_security", "td-vocab-security--Thing",
Expand Down
10 changes: 5 additions & 5 deletions packages/assertions/assertions/td-action-arrays.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
{
"title": "td-action-arrays",
"description": "The type of the members forms MUST be serialized as a JSON array.",
"$schema ": "http://json-schema.org/draft-06/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"is-complex":false,
"also": ["td-action-names_forms"],
"type": "object",
"properties": {
"actions": {
"additionalProperties": {
"$ref": "#/definitions/action_element"
"$ref": "#/$defs/action_element"
}
}
},
"required": [
"actions"
],
"additionalProperties": true,
"definitions": {
"$defs": {
"action_element": {
"type": "object",
"properties": {
"forms": {
"type": "array",
"items": {
"$ref": "#/definitions/form_element"
"$ref": "#/$defs/form_element"
}
}

Expand All @@ -37,7 +37,7 @@
"type": "object",
"properties": {
"href": {
"$ref": "#/definitions/url"
"$ref": "#/$defs/url"
},
"op": {
"oneOf": [{
Expand Down
6 changes: 3 additions & 3 deletions packages/assertions/assertions/td-action-names_at-type.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"title": "td-action-names_at-type",
"description": "Each optional vocabulary term as defined in the class Action and its superclass InteractionPattern MUST be serialized as a JSON name within an Action object.",
"$schema ": "http://json-schema.org/draft-06/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"is-complex":true,
"type": "object",
"properties": {
"actions": {
"additionalProperties": {
"$ref": "#/definitions/action_element"
"$ref": "#/$defs/action_element"
}
}
},
"additionalProperties": true,
"definitions": {
"$defs": {
"action_element": {
"if": {
"type": "object",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"title": "td-action-names_description",
"description": "Each optional vocabulary term as defined in the class Action and its superclass InteractionPattern MUST be serialized as a JSON name within an Action object.",
"$schema ": "http://json-schema.org/draft-06/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"is-complex":true,
"type": "object",
"properties": {
"actions": {
"additionalProperties": {
"$ref": "#/definitions/action_element"
"$ref": "#/$defs/action_element"
}
}
},
"additionalProperties": true,
"definitions": {
"$defs": {
"action_element": {
"if": {
"type": "object",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"title": "td-action-names_descriptions",
"description": "Each optional vocabulary term as defined in the class Action and its superclass InteractionPattern MUST be serialized as a JSON name within an Action object.",
"$schema ": "http://json-schema.org/draft-06/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"is-complex":true,
"type": "object",
"properties": {
"actions": {
"additionalProperties": {
"$ref": "#/definitions/action_element"
"$ref": "#/$defs/action_element"
}
}
},
"additionalProperties": true,
"definitions": {
"$defs": {
"action_element": {
"if": {
"type": "object",
Expand Down
6 changes: 3 additions & 3 deletions packages/assertions/assertions/td-action-names_title.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"title": "td-action-names_title",
"description": "Each optional vocabulary term as defined in the class Action and its superclass InteractionPattern MUST be serialized as a JSON name within an Action object.",
"$schema ": "http://json-schema.org/draft-06/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"is-complex":true,
"type": "object",
"properties": {
"actions": {
"additionalProperties": {
"$ref": "#/definitions/action_element"
"$ref": "#/$defs/action_element"
}
}
},
"additionalProperties": true,
"definitions": {
"$defs": {
"action_element": {
"if": {
"type": "object",
Expand Down
6 changes: 3 additions & 3 deletions packages/assertions/assertions/td-action-names_titles.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"title": "td-action-names_titles",
"description": "Each optional vocabulary term as defined in the class Action and its superclass InteractionPattern MUST be serialized as a JSON name within an Action object.",
"$schema ": "http://json-schema.org/draft-06/schema#",
"$schema": "http://json-schema.org/draft-07/schema#",
"is-complex":true,
"type": "object",
"properties": {
"actions": {
"additionalProperties": {
"$ref": "#/definitions/action_element"
"$ref": "#/$defs/action_element"
}
}
},
"additionalProperties": true,
"definitions": {
"$defs": {
"action_element": {
"if": {
"type": "object",
Expand Down
Loading

0 comments on commit a125e2e

Please sign in to comment.