-
-
Notifications
You must be signed in to change notification settings - Fork 427
bug - regenerating TS from YAML Swagger/OpenAPI file results an unstable output #1668
Copy link
Copy link
Open
Open
Copy link
Labels
bugSomething isn't workingSomething isn't working
Description
in the case where a Swagger/OpenAPI YAML file has several endpoints with the same suffix, the swagger-typescript-api library results with an unstable output when re-running it.
Starting from point 0 of a YAML file (see attached), try running on the file couple of times to see it "flip-flop", see screenshot below for demonstration:
npx --yes swagger-typescript-api generate -p ./scripts/repro-swagger-bug.yaml -o ./scripts/generated -n client.ts --single-http-client --extract-request-params --extract-request-body --extract-response-body --extract-response-error --extract-enums --sort-types --sort-routes --clean-output
see the YAML file below:
openapi: 3.0.3
info:
title: swagger-typescript-api non-deterministic suffix repro
version: "1.0"
paths:
/findings/exports:
get:
tags: [Findings]
summary: List finding exports
parameters:
- { name: offset, in: query, schema: { type: integer } }
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/ListExportsResponse"
/assets/exports:
get:
tags: [Assets]
summary: List asset exports
parameters:
- { name: offset, in: query, schema: { type: integer } }
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/ListExportsResponse"
/remediation/exports:
get:
tags: [Remediation]
summary: List remediation exports
parameters:
- { name: offset, in: query, schema: { type: integer } }
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/ListExportsResponse"
/exports:
get:
tags: [Exports]
summary: List all exports
parameters:
- { name: offset, in: query, schema: { type: integer } }
responses:
"200":
description: OK
content:
application/json:
schema:
$ref: "#/components/schemas/ListExportsResponse"
components:
schemas:
ListExportsResponse:
type: object
properties:
items:
type: array
items:
type: object
properties:
id: { type: string }
status: { type: string }
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working