-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Theo Truong <[email protected]>
- Loading branch information
Showing
9 changed files
with
246 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
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,12 @@ | ||
import OpenApiMerger from '../../merger/OpenApiMerger'; | ||
import fs from 'fs'; | ||
import yaml from 'yaml'; | ||
|
||
|
||
test('merge()', async () => { | ||
const merger = new OpenApiMerger('./test/merger/fixtures/spec/opensearch-openapi.yaml'); | ||
merger.merge('./test/merger/opensearch-openapi.yaml'); | ||
expect(fs.readFileSync('./test/merger/fixtures/expected.yaml', 'utf8')) | ||
.toEqual(fs.readFileSync('./test/merger/opensearch-openapi.yaml', 'utf8')); | ||
fs.unlinkSync('./test/merger/opensearch-openapi.yaml'); | ||
}); |
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,73 @@ | ||
openapi: 3.1.0 | ||
info: | ||
title: OpenSearch API | ||
description: OpenSearch API | ||
version: 1.0.0 | ||
paths: | ||
/adopt/{animal}: | ||
post: | ||
parameters: | ||
- $ref: '#/components/parameters/adopt::path.animal' | ||
requestBody: | ||
$ref: '#/components/requestBodies/adopt' | ||
responses: | ||
'200': | ||
$ref: '#/components/responses/adopt@200' | ||
components: | ||
parameters: | ||
_global::query.human: | ||
x-global: true | ||
name: human | ||
in: query | ||
description: Whether to return human readable values for statistics. | ||
schema: | ||
type: boolean | ||
default: true | ||
adopt::path.animal: | ||
name: animal | ||
in: path | ||
schema: | ||
$ref: '#/components/schemas/animals:Animal' | ||
indices.create::path.index: | ||
name: index | ||
in: path | ||
schema: | ||
type: string | ||
indices.create::query.pretty: | ||
name: pretty | ||
in: query | ||
schema: | ||
type: boolean | ||
requestBodies: | ||
adopt: {} | ||
indices.create: {} | ||
responses: | ||
adopt@200: | ||
description: '' | ||
application/json: | ||
schema: | ||
type: object | ||
indices.create@200: | ||
description: '' | ||
application/json: | ||
schema: | ||
type: object | ||
schemas: | ||
actions:Bark: | ||
type: string | ||
actions:Meow: | ||
type: string | ||
animals:Animal: | ||
oneOf: | ||
- $ref: '#/components/schemas/animals:Dog' | ||
- $ref: '#/components/schemas/animals:Cat' | ||
animals:Cat: | ||
type: object | ||
properties: | ||
meow: | ||
$ref: '#/components/schemas/actions:Meow' | ||
animals:Dog: | ||
type: object | ||
properties: | ||
bark: | ||
$ref: '#/components/schemas/actions:Bark' |
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,35 @@ | ||
openapi: 3.1.0 | ||
info: | ||
title: Ignored | ||
version: 1.0.0 | ||
paths: | ||
'/{index}': | ||
post: | ||
parameters: | ||
- $ref: '#/components/parameters/indices.create::path.index' | ||
- $ref: '#/components/parameters/indices.create::query.pretty' | ||
requestBody: | ||
$ref: '#/components/requestBodies/indices.create' | ||
responses: | ||
'200': | ||
$ref: '#/components/responses/indices.create@200' | ||
components: | ||
requestBodies: | ||
indices.create: {} | ||
parameters: | ||
indices.create::path.index: | ||
name: index | ||
in: path | ||
schema: | ||
type: string | ||
indices.create::query.pretty: | ||
name: pretty | ||
in: query | ||
schema: | ||
type: boolean | ||
responses: | ||
indices.create@200: | ||
description: '' | ||
application/json: | ||
schema: | ||
type: object |
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,30 @@ | ||
openapi: 3.1.0 | ||
info: | ||
title: OpenSearch API | ||
description: OpenSearch API | ||
version: 1.0.0 | ||
paths: | ||
'/adopt/{animal}': | ||
post: | ||
parameters: | ||
- $ref: '#/components/parameters/adopt::path.animal' | ||
requestBody: | ||
$ref: '#/components/requestBodies/adopt' | ||
responses: | ||
'200': | ||
$ref: '#/components/responses/adopt@200' | ||
components: | ||
requestBodies: | ||
adopt: {} | ||
parameters: | ||
adopt::path.animal: | ||
name: animal | ||
in: path | ||
schema: | ||
$ref: '../schemas/animals.yaml#/components/schemas/Animal' | ||
responses: | ||
adopt@200: | ||
description: '' | ||
application/json: | ||
schema: | ||
type: object |
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,18 @@ | ||
openapi: 3.1.0 | ||
info: | ||
title: OpenSearch API | ||
description: OpenSearch API | ||
version: 1.0.0 | ||
paths: | ||
'/adopt/{animal}': | ||
$ref: 'namespaces/shelter.yaml#/paths/~1adopt~1{animal}' | ||
components: | ||
parameters: | ||
_global::query.human: | ||
x-global: true | ||
name: human | ||
in: query | ||
description: Whether to return human readable values for statistics. | ||
schema: | ||
type: boolean | ||
default: true |
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,11 @@ | ||
openapi: 3.1.0 | ||
info: | ||
title: OpenSearch API | ||
description: OpenSearch API | ||
version: 1.0.0 | ||
components: | ||
schemas: | ||
Bark: | ||
type: string | ||
Meow: | ||
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,21 @@ | ||
openapi: 3.1.0 | ||
info: | ||
title: OpenSearch API | ||
description: OpenSearch API | ||
version: 1.0.0 | ||
components: | ||
schemas: | ||
Animal: | ||
oneOf: | ||
- $ref: '#/components/schemas/Dog' | ||
- $ref: '#/components/schemas/Cat' | ||
Dog: | ||
type: object | ||
properties: | ||
bark: | ||
$ref: 'actions.yaml#/components/schemas/Bark' | ||
Cat: | ||
type: object | ||
properties: | ||
meow: | ||
$ref: 'actions.yaml#/components/schemas/Meow' |