Skip to content

Commit

Permalink
fix(swr): make sure to not include comma when not valid while generat…
Browse files Browse the repository at this point in the history
…ing swrMutationFetcher (orval-labs#1271)
  • Loading branch information
AffeJonsson authored Mar 19, 2024
1 parent 54df332 commit ee01104
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/swr/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -703,7 +703,9 @@ export const ${swrKeyFnName} = (${queryKeyProps}) => [\`${route}\`${
export const ${swrMutationFetcherName} = (${swrProps} ${swrMutationFetcherOptions}) => {
return (_: string, ${swrMutationFetcherArg}: { arg: Arguments }): ${swrMutationFetcherType} => {
return ${operationName}(${httpFnProperties}${
swrMutationFetcherOptions.length ? ', options' : ''
swrMutationFetcherOptions.length
? (httpFnProperties.length ? ', ' : '') + 'options'
: ''
});
}
}\n`;
Expand Down
11 changes: 11 additions & 0 deletions tests/configs/swr.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,4 +145,15 @@ export default defineConfig({
},
},
},
nestedArrays: {
output: {
target: '../generated/swr/nested-arrays/endpoints.ts',
schemas: '../generated/swr/nested-arrays/model',
client: 'swr',
mock: true,
},
input: {
target: '../specifications/arrays.yaml',
},
},
});

0 comments on commit ee01104

Please sign in to comment.