-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: extend split and join commands to produce JSON output (#1305)
- Loading branch information
1 parent
72b225a
commit 1510e47
Showing
22 changed files
with
1,103 additions
and
39 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@redocly/cli': minor | ||
--- | ||
|
||
Add JSON output support to the `split` and `join` commands. |
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,23 @@ | ||
openapi: 3.0.0 | ||
info: | ||
title: Example API | ||
description: This is an example API. | ||
version: 1.0.0 | ||
servers: | ||
- url: https://redocly-example.com/api | ||
paths: | ||
/users/{userId}: | ||
parameters: | ||
- name: userId | ||
in: path | ||
description: ID of the user | ||
required: true | ||
schema: | ||
type: integer | ||
get: | ||
summary: Get user by ID | ||
responses: | ||
'200': | ||
description: OK | ||
'404': | ||
description: Not found |
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,49 @@ | ||
{ | ||
"openapi": "3.0.0", | ||
"info": { | ||
"title": "Example API", | ||
"description": "This is an example API.", | ||
"version": "1.0.0" | ||
}, | ||
"servers": [ | ||
{ | ||
"url": "https://redocly-example.com/api" | ||
} | ||
], | ||
"paths": { | ||
"/users/{userId}/orders/{orderId}": { | ||
"parameters": [ | ||
{ | ||
"name": "userId", | ||
"in": "path", | ||
"description": "ID of the user", | ||
"required": true, | ||
"schema": { | ||
"type": "integer" | ||
} | ||
}, | ||
{ | ||
"name": "orderId", | ||
"in": "path", | ||
"description": "ID of the order", | ||
"required": true, | ||
"schema": { | ||
"type": "integer" | ||
} | ||
} | ||
], | ||
"get": { | ||
"x-private": true, | ||
"summary": "Get an order by ID for a specific user", | ||
"responses": { | ||
"200": { | ||
"description": "OK" | ||
}, | ||
"404": { | ||
"description": "Not found" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
117 changes: 117 additions & 0 deletions
117
__tests__/join/json-and-yaml-input/json-output.snapshot.js
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,117 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`E2E join files with different extensions test with option: { | ||
name: 'first entrypoint is a json file', | ||
folder: 'json-and-yaml-input', | ||
entrypoints: [Array], | ||
snapshot: 'json-output.snapshot.js' | ||
} 1`] = ` | ||
{ | ||
"openapi": "3.0.0", | ||
"info": { | ||
"title": "Example API", | ||
"description": "This is an example API.", | ||
"version": "<version>" | ||
}, | ||
"servers": [ | ||
{ | ||
"url": "https://redocly-example.com/api" | ||
} | ||
], | ||
"tags": [ | ||
{ | ||
"name": "foo_other", | ||
"x-displayName": "other" | ||
}, | ||
{ | ||
"name": "bar_other", | ||
"x-displayName": "other" | ||
} | ||
], | ||
"paths": { | ||
"/users/{userId}/orders/{orderId}": { | ||
"parameters": [ | ||
{ | ||
"name": "userId", | ||
"in": "path", | ||
"description": "ID of the user", | ||
"required": true, | ||
"schema": { | ||
"type": "integer" | ||
} | ||
}, | ||
{ | ||
"name": "orderId", | ||
"in": "path", | ||
"description": "ID of the order", | ||
"required": true, | ||
"schema": { | ||
"type": "integer" | ||
} | ||
} | ||
], | ||
"get": { | ||
"x-private": true, | ||
"summary": "Get an order by ID for a specific user", | ||
"responses": { | ||
"200": { | ||
"description": "OK" | ||
}, | ||
"404": { | ||
"description": "Not found" | ||
} | ||
}, | ||
"tags": [ | ||
"foo_other" | ||
] | ||
} | ||
}, | ||
"/users/{userId}": { | ||
"parameters": [ | ||
{ | ||
"name": "userId", | ||
"in": "path", | ||
"description": "ID of the user", | ||
"required": true, | ||
"schema": { | ||
"type": "integer" | ||
} | ||
} | ||
], | ||
"get": { | ||
"summary": "Get user by ID", | ||
"responses": { | ||
"200": { | ||
"description": "OK" | ||
}, | ||
"404": { | ||
"description": "Not found" | ||
} | ||
}, | ||
"tags": [ | ||
"bar_other" | ||
] | ||
} | ||
} | ||
}, | ||
"components": {}, | ||
"x-tagGroups": [ | ||
{ | ||
"name": "foo", | ||
"tags": [ | ||
"foo_other" | ||
] | ||
}, | ||
{ | ||
"name": "bar", | ||
"tags": [ | ||
"bar_other" | ||
] | ||
} | ||
] | ||
} | ||
openapi.json: join processed in <test>ms | ||
`; |
76 changes: 76 additions & 0 deletions
76
__tests__/join/json-and-yaml-input/yaml-output.snapshot.js
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,76 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`E2E join files with different extensions test with option: { | ||
name: 'first entrypoint is a yaml file', | ||
folder: 'json-and-yaml-input', | ||
entrypoints: [Array], | ||
snapshot: 'yaml-output.snapshot.js' | ||
} 1`] = ` | ||
openapi: 3.0.0 | ||
info: | ||
title: Example API | ||
description: This is an example API. | ||
version: 1.0.0 | ||
servers: | ||
- url: https://redocly-example.com/api | ||
tags: | ||
- name: bar_other | ||
x-displayName: other | ||
- name: foo_other | ||
x-displayName: other | ||
paths: | ||
/users/{userId}: | ||
parameters: | ||
- name: userId | ||
in: path | ||
description: ID of the user | ||
required: true | ||
schema: | ||
type: integer | ||
get: | ||
summary: Get user by ID | ||
responses: | ||
'200': | ||
description: OK | ||
'404': | ||
description: Not found | ||
tags: | ||
- bar_other | ||
/users/{userId}/orders/{orderId}: | ||
parameters: | ||
- name: userId | ||
in: path | ||
description: ID of the user | ||
required: true | ||
schema: | ||
type: integer | ||
- name: orderId | ||
in: path | ||
description: ID of the order | ||
required: true | ||
schema: | ||
type: integer | ||
get: | ||
x-private: true | ||
summary: Get an order by ID for a specific user | ||
responses: | ||
'200': | ||
description: OK | ||
'404': | ||
description: Not found | ||
tags: | ||
- foo_other | ||
components: {} | ||
x-tagGroups: | ||
- name: bar | ||
tags: | ||
- bar_other | ||
- name: foo | ||
tags: | ||
- foo_other | ||
openapi.yaml: join processed in <test>ms | ||
`; |
Oops, something went wrong.
1510e47
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coverage report
Test suite run success
645 tests passing in 93 suites.
Report generated by 🧪jest coverage report action from 1510e47