tson-schema
Advanced tools
Comparing version 0.2.0 to 0.2.1
@@ -5,3 +5,3 @@ export interface TypedSchema<T> { | ||
} | ||
export declare type JSONSchema = boolean | number | object | string; | ||
export declare type JSONSchema = object; | ||
export interface BaseSchemaDefinition { | ||
@@ -8,0 +8,0 @@ /** |
{ | ||
"name": "tson-schema", | ||
"version": "0.2.0", | ||
"version": "0.2.1", | ||
"description": "A TypeScript API to create JSON-Schemas and TypeScript types", | ||
@@ -23,13 +23,15 @@ "files": [ | ||
"devDependencies": { | ||
"@types/ajv": "^1.0.0", | ||
"@types/tape": "^4.2.33", | ||
"nodemon": "^1.18.9", | ||
"ajv": "^6.10.0", | ||
"nodemon": "^1.18.10", | ||
"prettier": "^1.16.4", | ||
"tap-spec": "^5.0.0", | ||
"tape": "^4.9.2", | ||
"ts-node": "^8.0.2", | ||
"tslint": "^5.12.1", | ||
"tape": "^4.10.1", | ||
"ts-node": "^8.0.3", | ||
"tslint": "^5.13.1", | ||
"tslint-config-prettier": "^1.18.0", | ||
"tslint-plugin-prettier": "^2.0.1", | ||
"typescript": "^3.3.1" | ||
"typescript": "^3.3.3333" | ||
} | ||
} |
@@ -10,3 +10,2 @@ # tson-schema | ||
- `$ref` | ||
- JSON-Schema `anyOf`/`oneOf` | ||
- JSON-Schema conditional schemas (`if`/`else`) | ||
@@ -68,8 +67,17 @@ - Limited TypeScript support for: | ||
*/ | ||
const enumSchema = t.enum({ | ||
enum: ['A', 2, 'C', 4] | ||
}) | ||
const enumSchema = t.enum(['A', 2, 'C', 4]) | ||
enumSchema.getSchema() // { enum: ['A', 2, 'C', 4] } | ||
enumSchema.type // 'A' | 2 | 'C' | 4 | ||
/** | ||
* anyOf | ||
*/ | ||
const anyOfSchema = t.anyOf([ | ||
s.const('A'), | ||
s.integer() | ||
]) | ||
enumSchema.getSchema() // { anyOf: [{ const: 'A' }, { type: 'integer' }] } | ||
enumSchema.type // 'A' | number | ||
``` |
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
82
28372
12
35
381