typescript-to-json-schema
Inspired by YousefED/typescript-json-schema. Here's the differences list:
- this implementation does not use
typeChecker.getTypeAtLocation()(so probably it keeps correct type aliases) - the following features are not supported yet:
classtypes- conditional types
- processing AST and formatting JSON schema have been split into two independent steps
- not exported types, interfaces, enums are not exposed in the
definitionssection in the JSON schema
Usage
npm install typescript-to-json-schema./node_modules/.bin/typescript-to-json-schema \ --path 'my/project/**.*.ts' \ --type 'My.Type.Full.Name' \ --expose 'export' \ --topRef 'yes' \ --jsDoc 'extended'Current state
interfacetypesenumtypesunion,tuple,type[]typesstring,boolean,numbertypes"value",123,true,false,null,undefinedliterals- type aliases
- generics
typeofkeyof
Debug
npm run debug -- test/programs/type-alias-single/main.ts --aliasRefs true MyString
And connect via the debugger protocol.
AST Explorer is amazing for developers of this tool!