@ts-common/schema2ts

0.0.47 • Public • Published

schema2ts

JSON Schema to TypeScript. See also https://www.jsonschemavalidator.net/

See also http://json-schema.org/draft-07/schema

Normalized Schema Object

Excluding $id, $schema, $ref, $comment, title, description, default, readOnly, examples, contains, definitions, const, enum, if, then, else, allOf, anyOf, oneOf, not.

interface SimpleType {
  readonly array?: ArrayType
  readonly boolean?: BooleanType
  readonly integer?: IntegerType
  readonly null?: NullType
  readonly number?: NumberType
  readonly object?: ObjectType
  readonly string?: StringType
}

interface ArrayType {
    readonly additionalItems?: SchemaObject
    readonly items?: SchemaObject|ReadonlyArray<SchemaObject>
    readonly maxItems?: number
    readonly minItems: number
    readonly uniqueItems: boolean // default is false
}

interface BooleanType {
}

interface IntegerType extends NumberType {
}

interface NullType {
}

interface NumberType {
    readonly multipleOf?: number
    readonly maximum?: number
    readonly exclusiveMaximum?: number
    readonly minimum?: number
    readonly exclusiveMinimum?: number
}

interface ObjectType {
    readonly maxProperties?: number
    readonly minProperties: number // default is 0
    readonly required: ReadonlyArray<string> // default is []
    readonly additionalProperties?: SchemaObject
    readonly properties: StringMap<SchemaObject> // default is {}
    readonly patternProperties?: {} // ...
    readonly dependencies?: {} // ...
    readonly propertyNames?: {} // ...
}

interface StringType {
    readonly maxLength?: number
    readonly minLength: number // default is 0
    readonly patter?: string
    readonly format?: string
    readonly contentMediaType?: string
    readonly contentEncodinf?: string
}

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.0.470latest

Version History

VersionDownloads (Last 7 Days)Published
0.0.470
0.0.460
0.0.450
0.0.440
0.0.430
0.0.420
0.0.410
0.0.400
0.0.390
0.0.380
0.0.370
0.0.360
0.0.350
0.0.340
0.0.330
0.0.310
0.0.300
0.0.290
0.0.280
0.0.271
0.0.260
0.0.250
0.0.240
0.0.230
0.0.220
0.0.210
0.0.201
0.0.191
0.0.181
0.0.170
0.0.160
0.0.151
0.0.140
0.0.130
0.0.120
0.0.110
0.0.100
0.0.90
0.0.80
0.0.70
0.0.50
0.0.30
0.0.20
0.0.10
0.0.00

Package Sidebar

Install

npm i @ts-common/schema2ts

Weekly Downloads

5

Version

0.0.47

License

Apache-2.0

Unpacked Size

30.8 kB

Total Files

6

Last publish

Collaborators

  • lirenhe
  • billytrend
  • vladbarosan
  • sergeyshandar