@@ -1038,67 +1038,3 @@ export function exec(filePattern: string, fullTypeName: string, args = getDefaul
1038
1038
process . stdout . write ( json ) ;
1039
1039
}
1040
1040
}
1041
-
1042
- export function run ( ) {
1043
- var helpText = "Usage: node typescript-json-schema.js <path-to-typescript-files-or-tsconfig> <type>" ;
1044
- const defaultArgs = getDefaultArgs ( ) ;
1045
- var args = require ( "yargs" )
1046
- . usage ( helpText )
1047
- . demand ( 2 )
1048
- . boolean ( "refs" ) . default ( "refs" , defaultArgs . ref )
1049
- . describe ( "refs" , "Create shared ref definitions." )
1050
- . boolean ( "aliasRefs" ) . default ( "aliasRefs" , defaultArgs . aliasRef )
1051
- . describe ( "aliasRefs" , "Create shared ref definitions for the type aliases." )
1052
- . boolean ( "topRef" ) . default ( "topRef" , defaultArgs . topRef )
1053
- . describe ( "topRef" , "Create a top-level ref definition." )
1054
- . boolean ( "titles" ) . default ( "titles" , defaultArgs . titles )
1055
- . describe ( "titles" , "Creates titles in the output schema." )
1056
- . boolean ( "defaultProps" ) . default ( "defaultProps" , defaultArgs . defaultProps )
1057
- . describe ( "defaultProps" , "Create default properties definitions." )
1058
- . boolean ( "noExtraProps" ) . default ( "noExtraProps" , defaultArgs . noExtraProps )
1059
- . describe ( "noExtraProps" , "Disable additional properties in objects by default." )
1060
- . boolean ( "propOrder" ) . default ( "propOrder" , defaultArgs . propOrder )
1061
- . describe ( "propOrder" , "Create property order definitions." )
1062
- . boolean ( "typeOfKeyword" ) . default ( "typeOfKeyword" , defaultArgs . typeOfKeyword )
1063
- . describe ( "typeOfKeyword" , "Use typeOf keyword (https://goo.gl/DC6sni) for functions." )
1064
- . boolean ( "required" ) . default ( "required" , defaultArgs . required )
1065
- . describe ( "required" , "Create required array for non-optional properties." )
1066
- . boolean ( "strictNullChecks" ) . default ( "strictNullChecks" , defaultArgs . strictNullChecks )
1067
- . describe ( "strictNullChecks" , "Make values non-nullable by default." )
1068
- . boolean ( "ignoreErrors" ) . default ( "ignoreErrors" , defaultArgs . ignoreErrors )
1069
- . describe ( "ignoreErrors" , "Generate even if the program has errors." )
1070
- . alias ( "out" , "o" )
1071
- . describe ( "out" , "The output file, defaults to using stdout" )
1072
- . array ( "validationKeywords" ) . default ( "validationKeywords" , defaultArgs . validationKeywords )
1073
- . describe ( "validationKeywords" , "Provide additional validation keywords to include." )
1074
- . argv ;
1075
-
1076
- exec ( args . _ [ 0 ] , args . _ [ 1 ] , {
1077
- ref : args . refs ,
1078
- aliasRef : args . aliasRefs ,
1079
- topRef : args . topRef ,
1080
- titles : args . titles ,
1081
- defaultProps : args . defaultProps ,
1082
- noExtraProps : args . noExtraProps ,
1083
- propOrder : args . propOrder ,
1084
- typeOfKeyword : args . useTypeOfKeyword ,
1085
- required : args . required ,
1086
- strictNullChecks : args . strictNullChecks ,
1087
- ignoreErrors : args . ignoreErrors ,
1088
- out : args . out ,
1089
- validationKeywords : args . validationKeywords ,
1090
- excludePrivate : args . excludePrivate ,
1091
- } ) ;
1092
- }
1093
-
1094
- if ( typeof window === "undefined" && require . main === module ) {
1095
- run ( ) ;
1096
- }
1097
-
1098
- // exec("example/**/*.ts", "Invoice");
1099
- /*
1100
- let args = defaultArgs;
1101
- args.useRootRef = true;
1102
- const result = generateSchema(getProgramFromFiles(["test/programs/interface-recursion/main.ts"]), "MyObject", args);
1103
- console.log(JSON.stringify(result));
1104
- */
0 commit comments