Skip to content

Commit 14e735d

Browse files
author
uid10804
committed
fix(server): exception when json file contains float values
1 parent fe1f7e4 commit 14e735d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/server/src/specifications/swagger/swagger.defgen.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,13 @@ export class SwaggerDefGen {
4949
this.outSwagger += `${this.indentator}"format": "unsafe"`;
5050
}
5151
} else if (this.isFloatNumber(num)) {
52-
this.outSwagger += `${this.indentator}"format": "double"`;
52+
this.outSwagger += `${this.indentator}"type": "number",`;
53+
this.outSwagger += `${this.indentator}"format": "float"`;
5354
} else {
55+
this.outSwagger += `${this.indentator}"type": "number",`;
5456
this.outSwagger += `${this.indentator}"format": "unsafe"`;
5557
}
56-
this.outSwagger += `,${this.indentator}"example": "${num}"`;
58+
this.outSwagger += `,${this.indentator}"example": ${num}`;
5759
}
5860

5961
// date is ISO8601 format - https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14

0 commit comments

Comments
 (0)