@@ -23,6 +23,9 @@ allSchemas.forEach(async ({ absolutePath, apiFileName, outputPath }) => {
2323 const input = absolutePath ;
2424 const output = outputPath ;
2525
26+ const typePrefix = 'IMySuperPrefix'
27+ const typeSuffix = 'MySuperSuffix'
28+
2629 await generateApiForTest ( {
2730 name : name ,
2831 input : input ,
@@ -36,25 +39,41 @@ allSchemas.forEach(async ({ absolutePath, apiFileName, outputPath }) => {
3639 extractEnums : true ,
3740 extractRequestParams : true ,
3841 extractResponseError : true ,
39- typePrefix : "IMySuperPrefix" ,
40- typeSuffix : "MySuperSuffix" ,
42+ extractResponses : true ,
43+ typePrefix : typePrefix ,
44+ typeSuffix : typeSuffix ,
4145 sortTypes : true ,
46+ sortRoutes : true ,
4247 debugExtras : [ "generate-extended" , apiFileName ] ,
4348 } ) . then ( ( result ) => {
4449 result . configuration . modelTypes . forEach ( ( modelType ) => {
4550 if ( modelType . name ) {
46- if ( modelType . name . startsWith ( "IMySuperPrefixIMySuperPrefix" ) ) {
51+ if ( modelType . name . startsWith ( `${ typePrefix } ${ typePrefix } ` ) ) {
52+ throw new GenerateExtendedError (
53+ `[${ outputPath } ][${ apiFileName } ] modelType has prefix/suffix duplicates - ${ modelType . name } ` ,
54+ output ,
55+ name ,
56+ ) ;
57+ }
58+ if ( ! modelType . name . startsWith ( typePrefix ) ) {
59+ throw new GenerateExtendedError (
60+ `[${ outputPath } ][${ apiFileName } ] modelType has not prefix/suffix - ${ modelType . name } ` ,
61+ output ,
62+ name ,
63+ ) ;
64+ }
65+ if ( modelType . name . endsWith ( `${ typeSuffix } ${ typeSuffix } ` ) ) {
4766 throw new GenerateExtendedError (
48- `[${ outputPath } ][${ apiFileName } ] modelType has prefix/suffix duplicates - ${ modelType . name } ` ,
49- output ,
50- name ,
67+ `[${ outputPath } ][${ apiFileName } ] modelType has prefix/suffix duplicates - ${ modelType . name } ` ,
68+ output ,
69+ name ,
5170 ) ;
5271 }
53- if ( ! modelType . name . startsWith ( "IMySuperPrefix" ) ) {
72+ if ( ! modelType . name . endsWith ( typeSuffix ) ) {
5473 throw new GenerateExtendedError (
55- `[${ outputPath } ][${ apiFileName } ] modelType has not prefix/suffix - ${ modelType . name } ` ,
56- output ,
57- name ,
74+ `[${ outputPath } ][${ apiFileName } ] modelType has not prefix/suffix - ${ modelType . name } ` ,
75+ output ,
76+ name ,
5877 ) ;
5978 }
6079 }
0 commit comments