Created
February 8, 2018 19:51
-
-
Save moodysalem/6458e7a0056c1a27e2c1bfb83afcefe8 to your computer and use it in GitHub Desktop.
TypeScript type interfaces for Swagger Models
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface IDataType { | |
type: 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object'; | |
readOnly?: true; | |
writeOnly?: true; | |
} | |
interface IStringType extends IDataType { | |
type: 'string'; | |
format?: 'date' | 'date-time' | 'password' | 'byte' | 'binary' | 'uuid' | 'email' | 'uri' | 'hostname' | 'ipv4' | 'ipv6'; | |
} | |
interface INumberType extends IDataType { | |
type: 'number'; | |
format?: 'float' | 'double'; | |
minimum?: number; | |
maximum?: number; | |
} | |
interface IIntegerType extends IDataType { | |
type: 'integer'; | |
format?: 'int32' | 'int64'; | |
minimum?: number; | |
maximum?: number; | |
} | |
interface IBooleanType extends IDataType { | |
type: 'boolean'; | |
} | |
interface IArrayType extends IDataType { | |
type: 'array'; | |
items: IDataType; | |
} | |
interface IObjectType extends IDataType { | |
type: 'object'; | |
properties: { | |
[key: string]: IDataType | |
}; | |
required: string[]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment