-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added tests for merger Signed-off-by: Theo Truong <[email protected]> * # checking if build step was successful Signed-off-by: Theo Truong <[email protected]> * # removed diagnostic code Signed-off-by: Theo Truong <[email protected]> * # added validation for global spec Signed-off-by: Theo Truong <[email protected]> # updated docs --------- Signed-off-by: Theo Truong <[email protected]>
- Loading branch information
Showing
15 changed files
with
332 additions
and
8 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
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
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,81 @@ | ||
openapi: 3.1.0 | ||
info: | ||
title: OpenSearch API | ||
description: OpenSearch API | ||
version: 1.0.0 | ||
paths: | ||
/adopt/{animal}: | ||
get: | ||
parameters: | ||
- $ref: '#/components/parameters/adopt::path.animal' | ||
- $ref: '#/components/parameters/_global::query.human' | ||
responses: | ||
'200': | ||
$ref: '#/components/responses/adopt@200' | ||
post: | ||
parameters: | ||
- $ref: '#/components/parameters/adopt::path.animal' | ||
- $ref: '#/components/parameters/_global::query.human' | ||
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,36 @@ | ||
openapi: 3.1.0 | ||
info: | ||
title: OpenSearch API | ||
description: OpenSearch API | ||
version: 1.0.0 | ||
paths: | ||
'/adopt/{animal}': | ||
get: | ||
parameters: | ||
- $ref: '#/components/parameters/adopt::path.animal' | ||
responses: | ||
'200': | ||
$ref: '#/components/responses/adopt@200' | ||
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 |
Oops, something went wrong.