Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug: Unable to use {service-name} interpolation for filenames with openapi3-emitter when only one service is defined #6182

Merged
merged 12 commits into from
Mar 3, 2025
Prev Previous commit
Next Next commit
revert
  • Loading branch information
albertxavier100 committed Feb 28, 2025
commit 7006c1a5f3096ad23e869086a3c00e3aea69b1b7
150 changes: 74 additions & 76 deletions packages/openapi3/test/emit-openapi.test.ts
Original file line number Diff line number Diff line change
@@ -1,81 +1,79 @@
import { describe, expect, it } from "vitest";
import { worksFor } from "./works-for.js";
import { emitOpenApiWithDiagnostics } from "./test-host.js";

describe("Scalar formats of serialized document in YAML", () => {
worksFor(["3.0.0", "3.1.0"], (helper) => {
it("should add single quote for y|Y|yes|Yes|YES|n|N|no|No|NO|true|True|TRUE|false|False|FALSE|on|On|ON|off|Off|OFF", async () => {
const [_, __, content] = await helper.emitOpenApiWithDiagnostics(`
enum TestEnum {
y: "y",
Y: "Y",
yes: "yes",
Yes: "Yes",
YES: "YES",
yEs: "yEs",
n: "n",
N: "N",
no: "no",
No: "No",
NO: "NO",
nO: "nO",
"true": "true",
True: "True",
TRUE: "TRUE",
tRUE: "tRUE",
"false": "false",
False: "False",
FALSE: "FALSE",
fALSE: "fALSE",
on: "on",
On: "On",
ON: "ON",
oN: "oN",
off: "off",
Off: "Off",
OFF: "OFF",
oFF: "oFF"
}
`);
expect(content).toBe(`openapi: 3.0.0
info:
title: (title)
version: 0.0.0
tags: []
paths: {}
components:
schemas:
TestEnum:
type: string
enum:
- 'y'
- 'Y'
- 'yes'
- 'Yes'
- 'YES'
- yEs
- 'n'
- 'N'
- 'no'
- 'No'
- 'NO'
- nO
- 'true'
- 'True'
- 'TRUE'
- tRUE
- 'false'
- 'False'
- 'FALSE'
- fALSE
- 'on'
- 'On'
- 'ON'
- oN
- 'off'
- 'Off'
- 'OFF'
- oFF
`);
});
it("should add single quote for y|Y|yes|Yes|YES|n|N|no|No|NO|true|True|TRUE|false|False|FALSE|on|On|ON|off|Off|OFF", async () => {
const [_, __, content] = await emitOpenApiWithDiagnostics(`
enum TestEnum {
y: "y",
Y: "Y",
yes: "yes",
Yes: "Yes",
YES: "YES",
yEs: "yEs",
n: "n",
N: "N",
no: "no",
No: "No",
NO: "NO",
nO: "nO",
"true": "true",
True: "True",
TRUE: "TRUE",
tRUE: "tRUE",
"false": "false",
False: "False",
FALSE: "FALSE",
fALSE: "fALSE",
on: "on",
On: "On",
ON: "ON",
oN: "oN",
off: "off",
Off: "Off",
OFF: "OFF",
oFF: "oFF"
}
`);
expect(content).toBe(`openapi: 3.0.0
info:
title: (title)
version: 0.0.0
tags: []
paths: {}
components:
schemas:
TestEnum:
type: string
enum:
- 'y'
- 'Y'
- 'yes'
- 'Yes'
- 'YES'
- yEs
- 'n'
- 'N'
- 'no'
- 'No'
- 'NO'
- nO
- 'true'
- 'True'
- 'TRUE'
- tRUE
- 'false'
- 'False'
- 'FALSE'
- fALSE
- 'on'
- 'On'
- 'ON'
- oN
- 'off'
- 'Off'
- 'OFF'
- oFF
`);
});
});
Loading