Skip to content

Commit 5ffc1f2

Browse files
committed
✨ Include 3xx status codes when searching for a default response code
1 parent 544dbfd commit 5ffc1f2

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

starter/api/rest/src/view/cli/openapi/generate.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ export const run = async (argv: any): Promise<void> => {
3434
Object.keys(pathSpec).forEach(method => {
3535
if (pathSpec[method]?.operationId) {
3636
const operationResponses = pathSpec[method].responses ?? {}
37-
const successStatus =
38-
Object.keys(operationResponses).find(status =>
39-
status.startsWith('2')
40-
) ?? '200'
37+
const responseCodes = Object.keys(operationResponses)
38+
const successStatus = responseCodes.find(s => s.startsWith('2'))
39+
?? responseCodes.find(s => s.startsWith('3'))
40+
?? '200';
4141

4242
acc[pathSpec[method].operationId] = {
4343
method,

0 commit comments

Comments
 (0)