File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed
Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -72,12 +72,29 @@ function isRawObject(schema: string) {
7272 return ( / \{ .* \} / ) . test ( schema ) ;
7373}
7474
75- export function filterGenericSchemas ( resolvedSchemas : string [ ] ) {
75+ function isEverydayType ( schema : string ) {
7676 const genericSchemas = [
7777 "string" ,
7878 "number" ,
7979 "boolean" ,
8080 "unknown" ,
8181 ] ;
82- return resolvedSchemas . filter ( s => ! genericSchemas . includes ( s ) && ! isRawObject ( s ) ) ;
82+ return genericSchemas . includes ( schema ) ;
83+ }
84+
85+ function isArraySchema ( schema : string ) {
86+ return schema . includes ( "[]" ) ;
87+ }
88+
89+ function isGenericSchema ( schema : string ) {
90+ if ( isArraySchema ( schema ) ) {
91+ return isGenericSchema ( schema . replace ( "[]" , "" ) ) ;
92+ }
93+ if ( isEverydayType ( schema ) ) return true ;
94+ if ( isRawObject ( schema ) ) return true ;
95+ return false ;
96+ }
97+
98+ export function filterGenericSchemas ( resolvedSchemas : string [ ] ) {
99+ return resolvedSchemas . filter ( s => ! isGenericSchema ( s ) ) ;
83100}
You can’t perform that action at this time.
0 commit comments