tsbuffer-validator
Advanced tools
Comparing version 0.2.0 to 0.3.0
{ | ||
"name": "tsbuffer-validator", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "Validator for TSBuffer values", | ||
@@ -37,3 +37,3 @@ "main": "index.js", | ||
"k8w-extend-native": "^1.1.0", | ||
"tsbuffer-schema": "^0.6.0" | ||
"tsbuffer-schema": "^0.7.0" | ||
}, | ||
@@ -40,0 +40,0 @@ "nyc": { |
@@ -10,3 +10,3 @@ import { TSBufferProto, TSBufferSchema } from "tsbuffer-schema"; | ||
/** 将ReferenceTYpeSchema层层转换为它最终实际引用的类型 */ | ||
parseReference(schema: TypeReference): Exclude<TSBufferSchema, TypeReference>; | ||
parseReference(schema: TSBufferSchema): Exclude<TSBufferSchema, TypeReference>; | ||
isInterface(schema: TSBufferSchema, excludeReference?: boolean): schema is InterfaceTypeSchema | InterfaceReference; | ||
@@ -13,0 +13,0 @@ isTypeReference(schema: TSBufferSchema): schema is TypeReference; |
@@ -33,3 +33,3 @@ "use strict"; | ||
// IndexedAccess | ||
else { | ||
else if (schema.type === 'IndexedAccess') { | ||
if (!this.isInterface(schema.objectType)) { | ||
@@ -74,2 +74,5 @@ throw new Error("Error objectType: " + schema.objectType.type); | ||
} | ||
else { | ||
return schema; | ||
} | ||
}; | ||
@@ -131,5 +134,5 @@ ProtoHelper.prototype.isInterface = function (schema, excludeReference) { | ||
for (var _b = 0, _c = schema.extends; _b < _c.length; _b++) { | ||
var extendsRef = _c[_b]; | ||
var extend = _c[_b]; | ||
// 解引用 | ||
var parsedExtRef = this.parseReference(extendsRef); | ||
var parsedExtRef = this.parseReference(extend.type); | ||
if (parsedExtRef.type !== 'Interface') { | ||
@@ -136,0 +139,0 @@ throw new Error('SchemaError: extends must from interface but from ' + parsedExtRef.type); |
@@ -204,5 +204,8 @@ "use strict"; | ||
extends: [{ | ||
type: 'Reference', | ||
path: 'a', | ||
targetName: 'a1' | ||
id: 0, | ||
type: { | ||
type: 'Reference', | ||
path: 'a', | ||
targetName: 'a1' | ||
} | ||
}] | ||
@@ -209,0 +212,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
130922
2176
+ Addedtsbuffer-schema@0.7.0(transitive)
- Removedtsbuffer-schema@0.6.0(transitive)
Updatedtsbuffer-schema@^0.7.0