7
7
GetterParameters ,
8
8
GetterQueryParam ,
9
9
} from '../types' ;
10
- import { pascal , sanitize } from '../utils' ;
10
+ import { jsDoc , pascal , sanitize } from '../utils' ;
11
11
import { getEnum } from './enum' ;
12
12
import { getKey } from './keys' ;
13
13
@@ -52,12 +52,13 @@ const getQueryParamsTypes = (
52
52
} ) ;
53
53
54
54
const key = getKey ( name ) ;
55
+ const doc = jsDoc ( parameter ) ;
55
56
56
57
if ( parameterImports . length ) {
57
58
return {
58
- definition : `${ key } ${ ! required || schema . default ? '?' : '' } : ${
59
+ definition : `${ doc } ${ key } ${ ! required || schema . default ? '?' : '' } : ${
59
60
parameterImports [ 0 ] . name
60
- } `,
61
+ } ; `,
61
62
imports : parameterImports ,
62
63
schemas : [ ] ,
63
64
} ;
@@ -73,9 +74,9 @@ const getQueryParamsTypes = (
73
74
) ;
74
75
75
76
return {
76
- definition : `${ key } ${
77
+ definition : `${ doc } ${ key } ${
77
78
! required || schema . default ? '?' : ''
78
- } : ${ enumName } `,
79
+ } : ${ enumName } ; `,
79
80
imports : [ { name : enumName } ] ,
80
81
schemas : [
81
82
...resolvedeValue . schemas ,
@@ -84,9 +85,9 @@ const getQueryParamsTypes = (
84
85
} ;
85
86
}
86
87
87
- const definition = `${ key } ${ ! required || schema . default ? '?' : '' } : ${
88
- resolvedeValue . value
89
- } `;
88
+ const definition = `${ doc } ${ key } ${
89
+ ! required || schema . default ? '?' : ''
90
+ } : ${ resolvedeValue . value } ; `;
90
91
91
92
return {
92
93
definition,
@@ -115,12 +116,12 @@ export const getQueryParams = ({
115
116
const schemas = types . flatMap ( ( { schemas } ) => schemas ) ;
116
117
const name = `${ pascal ( operationName ) } ${ pascal ( suffix ) } ` ;
117
118
118
- const type = types . map ( ( { definition } ) => definition ) . join ( '; ' ) ;
119
+ const type = types . map ( ( { definition } ) => definition ) . join ( '\n ' ) ;
119
120
const allOptional = queryParams . every ( ( { parameter } ) => ! parameter . required ) ;
120
121
121
122
const schema = {
122
123
name,
123
- model : `export type ${ name } = { ${ type } };\n` ,
124
+ model : `export type ${ name } = {\n ${ type } \n };\n` ,
124
125
imports,
125
126
} ;
126
127
1 commit comments
vercel[bot] commentedon Mar 2, 2023
Successfully deployed to the following URLs:
orval – ./
orval.vercel.app
orval-anymaniax.vercel.app
www.orval.dev
orval.dev
orval-git-master-anymaniax.vercel.app