Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove dependency on tv4-formats #498

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 2 additions & 17 deletions package-lock.json

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

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@signalk/signalk-schema",
"version": "1.0.4",
"version": "1.0.5",
"description": "SignalK specification schema as an npm module with tests",
"main": "dist/index.js",
"scripts": {
Expand Down Expand Up @@ -47,8 +47,7 @@
"debug": "^2.2.0",
"json-schema-ref-parser": "^3.1.2",
"lodash": "^3.10.1",
"tv4": "^1.2.7",
"tv4-formats": "^2.2.1"
"tv4": "^1.2.7"
},
"devDependencies": {
"babel-cli": "^6.24.1",
Expand Down
8 changes: 3 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ function getTv4() {
tv4.addSchema('https://signalk.org/specification/1.0.0/schemas/external/geojson/geometry.json', externalGeometry);
tv4.addSchema('http://json-schema.org/geojson/geometry.json', externalGeometry);

tv4.addFormat(require('tv4-formats'))

return tv4;
}

Expand Down Expand Up @@ -118,7 +116,7 @@ function chaiAsPromised(chai, utils) {
Assertion.addProperty('validSignalKIgnoringSelf', function() {
this._obj.self = 'urn:mrn:imo:mmsi:230099999';
checkValidFullSignalK.call(this);
});
});
Assertion.addProperty('validSignalKVessel', function() {
this._obj = {
'vessels': {
Expand Down Expand Up @@ -318,12 +316,12 @@ module.exports.getAISShipTypeName = function(id) {
const the_enum = subSchemas['design'].properties.aisShipType.allOf[1].properties.value.allOf[1].enum;
//const the_enum = module.exports.getMetadata('vessels.foo.design.aisShipType').enum
var res = the_enum.find(item => { return item.id == id });
return res ? res.name : undefined
return res ? res.name : undefined
}


module.exports.getAtonTypeName = function(id) {
const the_enum = require('../schemas/aton.json').properties.atonType.allOf[1].properties.value.allOf[1].enum;
var res = the_enum.find(item => { return item.id == id });
return res ? res.name : undefined
return res ? res.name : undefined
}