Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

raml-typesystem

Package Overview
Dependencies
Maintainers
2
Versions
95
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

raml-typesystem - npm Package Compare versions

Comparing version 0.0.32 to 0.0.33

1

dist/src/nominal-types.d.ts

@@ -118,2 +118,3 @@ import ti = require("./nominal-interfaces");

allSubTypes(): ITypeDefinition[];
_allSupers: ITypeDefinition[];
allSuperTypes(): ITypeDefinition[];

@@ -120,0 +121,0 @@ private allSuperTypesRecurrent(t, m, result);

@@ -382,5 +382,9 @@ "use strict";

AbstractType.prototype.allSuperTypes = function () {
if (this._allSupers) {
return this._allSupers;
}
var rs = [];
this.allSuperTypesRecurrent(this, {}, rs);
return _.unique(rs);
this._allSupers = _.unique(rs);
return this._allSupers;
};

@@ -387,0 +391,0 @@ AbstractType.prototype.allSuperTypesRecurrent = function (t, m, result) {

2

dist/src/nominals.js

@@ -55,3 +55,3 @@ "use strict";

}
else if (t.isUnion()) {
else if (t instanceof ts.UnionType) {
var ut = new nt.Union(t.name(), null);

@@ -58,0 +58,0 @@ if (t.superTypes().length == 0) {

@@ -285,3 +285,2 @@ "use strict";

}
3;
var tpes = n.childWithKey("types");

@@ -288,0 +287,0 @@ if (tpes && tpes.kind() === NodeKind.ARRAY) {

@@ -25,2 +25,3 @@ /// <reference path="../../typings/main.d.ts" />

constructor(schema: string, provider: IContentProvider);
fixRequired(obj: any): void;
getType(): string;

@@ -27,0 +28,0 @@ validateObject(object: any): any;

@@ -92,3 +92,9 @@ "use strict";

this.setupId(jsonSchemaObject, this.provider.contextPath());
jsonSchemaObject = api.v4(jsonSchemaObject);
var schemaVer = "" + jsonSchemaObject["$schema"];
if (schemaVer.indexOf("http://json-schema.org/draft-04/") == -1) {
jsonSchemaObject = api.v4(jsonSchemaObject);
}
else {
this.fixRequired(jsonSchemaObject);
}
}

@@ -101,2 +107,16 @@ catch (e) {

}
JSONSchemaObject.prototype.fixRequired = function (obj) {
// Object.keys(obj).forEach(x=>{
// var val=obj[x];
// if (x==="required"){
// if (typeof val==="string"){
// obj[x]=[val];
// }
// }
// if (x==="properties"||x==="items"||x==="additionalItems"||x==="patternProperties"){
// this.fixRequired(val);
// }
//
// })
};
JSONSchemaObject.prototype.getType = function () {

@@ -103,0 +123,0 @@ return "source.json";

@@ -9,3 +9,3 @@ "use strict";

var tp = ps.parseJSON("SomeType", {
type: '{"$schema":"http://json-schema.org/draft-04/schema","type":"object","properties":{"parentName":{"type":"string","required":true},"child":{"$ref":"./content/jsonschemetest/test1/scheme.json#"}}}'
type: '{"$schema":"http://json-schema.org/draft-04/schema","type":"object","properties":{"parentName":{"type":"string"},"child":{"$ref":"./content/jsonschemetest/test1/scheme.json#"}}}'
});

@@ -16,3 +16,3 @@ assert.isTrue(tp.validate({ parentName: "someName", child: { childName: "anotherName" } }).isOk());

var tp = ps.parseJSON("SomeType", {
type: '{"$schema":"http://json-schema.org/draft-04/schema","type":"object","properties":{"parentName":{"type":"string","required":true},"child":{"$ref":"./content/jsonschemetest/test1/scheme.json#"}}}'
type: '{"$schema":"http://json-schema.org/draft-04/schema","type":"object","properties":{"parentName":{"type":"string"},"child":{"$ref":"./content/jsonschemetest/test1/scheme.json#"}}}'
});

@@ -19,0 +19,0 @@ assert.isTrue(!tp.validate({ parentName: "someName", child: { childName1: "anotherName" } }).isOk());

@@ -223,3 +223,3 @@ "use strict";

a: {
"type": "\n {\n \"required\": \"message\",\n \"$schema\": \"http://json-schema.org/draft-04/schema\",\n \"type\": \"object\",\n \"properties\": {\n \"message\": {\n \"required\": true,\n \"type\": \"string\"\n }\n },\n \"additionalProperties\": false\n }",
"type": "\n {\n \"$schema\": \"http://json-schema.org/draft-04/schema\",\n \"type\": \"object\",\n \"properties\": {\n \"message\": {\n \"type\": \"string\"\n }\n },\n \"additionalProperties\": false\n }",
example: "{ \"message\":\"s\" ,\"r\":2 }"

@@ -226,0 +226,0 @@ }

{
"name": "raml-typesystem",
"version": "0.0.32",
"version": "0.0.33",
"main": "dist/src/index.js",

@@ -5,0 +5,0 @@ "scripts": {

@@ -443,6 +443,12 @@ import ti = require("./nominal-interfaces")

}
_allSupers:ITypeDefinition[];
allSuperTypes():ITypeDefinition[]{
if (this._allSupers){
return this._allSupers;
}
var rs:ITypeDefinition[]=[];
this.allSuperTypesRecurrent(<any>this,{},rs);
return _.unique(rs);
this._allSupers= _.unique(rs);
return this._allSupers;
}

@@ -449,0 +455,0 @@ private allSuperTypesRecurrent(t:ITypeDefinition,m:{[name:string]:ITypeDefinition},result:ITypeDefinition[]){

@@ -74,3 +74,3 @@ import ts=require("./typesystem")

}
else if (t.isUnion()) {
else if (t instanceof ts.UnionType) {
var ut = new nt.Union(t.name(), null);

@@ -77,0 +77,0 @@ if (t.superTypes().length==0) {

@@ -313,3 +313,3 @@ import ts=require("./typesystem")

})
}3
}

@@ -325,3 +325,3 @@ var tpes=n.childWithKey("types");

}
var reg=new AccumulatingRegistry(tpes,schemas,tr,result);

@@ -328,0 +328,0 @@ if (tpes&&tpes.kind()!==NodeKind.SCALAR){

@@ -133,4 +133,9 @@ /// <reference path="../typings/main.d.ts" />

this.setupId(jsonSchemaObject, this.provider.contextPath());
jsonSchemaObject =api.v4(jsonSchemaObject);
var schemaVer=""+jsonSchemaObject["$schema"];
if (schemaVer.indexOf("http://json-schema.org/draft-04/")==-1){
jsonSchemaObject =api.v4(jsonSchemaObject);
}
else{
this.fixRequired(jsonSchemaObject);
}
} catch (e){

@@ -144,2 +149,16 @@ throw new Error('Can not parse schema'+schema)

}
fixRequired(obj:any){
// Object.keys(obj).forEach(x=>{
// var val=obj[x];
// if (x==="required"){
// if (typeof val==="string"){
// obj[x]=[val];
// }
// }
// if (x==="properties"||x==="items"||x==="additionalItems"||x==="patternProperties"){
// this.fixRequired(val);
// }
//
// })
}

@@ -146,0 +165,0 @@ getType() : string {

@@ -9,3 +9,3 @@ import ps= require("./actualParse")

var tp = ps.parseJSON("SomeType", {
type: '{"$schema":"http://json-schema.org/draft-04/schema","type":"object","properties":{"parentName":{"type":"string","required":true},"child":{"$ref":"./content/jsonschemetest/test1/scheme.json#"}}}'
type: '{"$schema":"http://json-schema.org/draft-04/schema","type":"object","properties":{"parentName":{"type":"string"},"child":{"$ref":"./content/jsonschemetest/test1/scheme.json#"}}}'
});

@@ -17,3 +17,3 @@

var tp = ps.parseJSON("SomeType", {
type: '{"$schema":"http://json-schema.org/draft-04/schema","type":"object","properties":{"parentName":{"type":"string","required":true},"child":{"$ref":"./content/jsonschemetest/test1/scheme.json#"}}}'
type: '{"$schema":"http://json-schema.org/draft-04/schema","type":"object","properties":{"parentName":{"type":"string"},"child":{"$ref":"./content/jsonschemetest/test1/scheme.json#"}}}'
});

@@ -20,0 +20,0 @@

@@ -255,3 +255,2 @@ import ps= require("./actualParse")

{
"required": "message",
"$schema": "http://json-schema.org/draft-04/schema",

@@ -261,3 +260,2 @@ "type": "object",

"message": {
"required": true,
"type": "string"

@@ -264,0 +262,0 @@ }

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc