-
-
Notifications
You must be signed in to change notification settings - Fork 476
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
109 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
openapi: "3.1.0" | ||
info: | ||
title: Test | ||
version: "1.0.0" | ||
x-error-response: &x-error-response | ||
4XX: | ||
description: Error response | ||
content: | ||
application/json: | ||
schema: | ||
$ref: '#/components/schemas/HTTPError' | ||
paths: | ||
/admin/ping: | ||
get: | ||
summary: Ping pongs | ||
operationId: AdminPing | ||
responses: | ||
"200": | ||
description: OK | ||
content: | ||
text/plain: | ||
schema: | ||
type: string | ||
example: pong | ||
!!merge <<: *x-error-response | ||
tags: | ||
- admin | ||
components: | ||
schemas: | ||
HTTPError: | ||
description: represents an error message response. | ||
type: object | ||
properties: | ||
title: | ||
type: string | ||
detail: | ||
type: string | ||
status: | ||
type: integer | ||
error: | ||
type: string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import { execa } from "execa"; | ||
|
||
const CMD = "./bin/cli.js"; | ||
const cwd = new URL("../", import.meta.url); | ||
|
||
describe("YAML features", () => { | ||
it("merge", async () => { | ||
const result = await execa(CMD, ["./test/fixtures/yaml-merge.yaml"], { cwd }); | ||
expect(result.stdout).toMatchInlineSnapshot(` | ||
"/** | ||
* This file was auto-generated by openapi-typescript. | ||
* Do not make direct changes to the file. | ||
*/ | ||
export interface paths { | ||
\\"/admin/ping\\": { | ||
/** Ping pongs */ | ||
get: operations[\\"AdminPing\\"]; | ||
}; | ||
} | ||
export type webhooks = Record<string, never>; | ||
export interface components { | ||
schemas: { | ||
/** @description represents an error message response. */ | ||
HTTPError: { | ||
title?: string; | ||
detail?: string; | ||
status?: number; | ||
error?: string; | ||
}; | ||
}; | ||
responses: never; | ||
parameters: never; | ||
requestBodies: never; | ||
headers: never; | ||
pathItems: never; | ||
} | ||
export type external = Record<string, never>; | ||
export interface operations { | ||
/** Ping pongs */ | ||
AdminPing: { | ||
responses: { | ||
/** @description OK */ | ||
200: { | ||
content: { | ||
\\"text/plain\\": string; | ||
}; | ||
}; | ||
/** @description Error response */ | ||
\\"4XX\\": { | ||
content: { | ||
\\"application/json\\": components[\\"schemas\\"][\\"HTTPError\\"]; | ||
}; | ||
}; | ||
}; | ||
}; | ||
}" | ||
`); | ||
}); | ||
}); |