File tree Expand file tree Collapse file tree 3 files changed +8
-4
lines changed
Expand file tree Collapse file tree 3 files changed +8
-4
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " typia" ,
3- "version" : " 11.0.1 " ,
3+ "version" : " 11.0.2 " ,
44 "description" : " Superfast runtime validators with only one line" ,
55 "main" : " lib/index.js" ,
66 "typings" : " lib/index.d.ts" ,
Original file line number Diff line number Diff line change @@ -11,17 +11,17 @@ export const json_schema_jsDocTags = <Schema extends OpenApi.IJsonSchema>(
1111
1212 const value : string | undefined = tag . text
1313 ?. filter ( ( s ) => s . kind === "text" )
14- . map ( ( s ) => s . text . split ( "\r\n" ) . join ( "\n" ) ) [ 0 ] ;
14+ . map ( ( s ) => s . text . trim ( ) . split ( "\r\n" ) . join ( "\n" ) ) [ 0 ] ;
1515 if ( value === undefined ) continue ;
1616 else ( schema as any ) [ tag . name ] = cast ( value ) ;
1717 }
1818 return schema ;
1919} ;
2020
21- const cast = ( value : string ) : string | number | boolean => {
21+ const cast = ( value : string ) : string | number | boolean | null => {
2222 if ( value === "true" ) return true ;
2323 if ( value === "false" ) return false ;
2424 const num : number = Number ( value ) ;
2525 if ( Number . isNaN ( num ) === false ) return num ;
26- return value ;
26+ return value === "null" ? null : value ;
2727} ;
Original file line number Diff line number Diff line change @@ -15,6 +15,9 @@ export const test_pr_1714_json_schema_plugin_by_jsDocTags = (): void => {
1515 TestValidator . equals ( "x-autobe-database-schema" ) (
1616 ( something as any ) ?. [ "x-autobe-database-schema" ] ,
1717 ) ( "somethings" ) ;
18+ TestValidator . equals ( "x-null-value" ) (
19+ ( something . properties ?. id as any ) ?. [ "x-null-value" ] ,
20+ ) ( null ) ;
1821 TestValidator . equals ( "x-custom-tag" ) (
1922 ( something . properties ?. id as any ) ?. [ "x-custom-tag" ] ,
2023 ) ( 3 ) ;
@@ -36,6 +39,7 @@ interface ISomething {
3639 * Primary Key.
3740 *
3841 * @x -autobe-database-schema-member id
42+ * @x -null-value null
3943 * @x -custom-tag 3
4044 * @x -valid true
4145 * @regular This is a regular tag and should be ignored.
You can’t perform that action at this time.
0 commit comments