-
Notifications
You must be signed in to change notification settings - Fork 182
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(cli): Add
write-definition
tests for server / environment han…
…dling (#6119) chore(cli): Add `write-definition` tests for server / environment handling.
- Loading branch information
Showing
54 changed files
with
1,377 additions
and
6 deletions.
There are no files selected for viewing
538 changes: 538 additions & 0 deletions
538
packages/cli/ete-tests/src/tests/write-definition/__snapshots__/writeDefinition.test.ts.snap
Large diffs are not rendered by default.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
...sts/write-definition/fixtures/multiple-no-endpoint-async/fern/.definition/__package__.yml
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,19 @@ | ||
service: | ||
auth: false | ||
base-path: '' | ||
endpoints: | ||
list: | ||
auth: false | ||
examples: | ||
- response: | ||
body: string | ||
method: GET | ||
path: /pets | ||
response: | ||
docs: A response | ||
status-code: 200 | ||
type: string | ||
source: | ||
openapi: openapi.yml | ||
source: | ||
openapi: openapi.yml |
17 changes: 17 additions & 0 deletions
17
...s/src/tests/write-definition/fixtures/multiple-no-endpoint-async/fern/.definition/api.yml
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,17 @@ | ||
default-environment: Prod | ||
default-url: Base | ||
display-name: Test API | ||
environments: | ||
Dev: | ||
urls: | ||
Base: http://dev.api.com | ||
websocket: wss://api.async.com | ||
websocket2: wss://api2.async.com | ||
Prod: | ||
urls: | ||
Base: http://prod.api.com | ||
websocket: wss://api.async.com | ||
websocket2: wss://api2.async.com | ||
error-discrimination: | ||
strategy: status-code | ||
name: api |
15 changes: 15 additions & 0 deletions
15
...sts/write-definition/fixtures/multiple-no-endpoint-async/fern/.definition/testChannel.yml
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,15 @@ | ||
types: | ||
TestChannelPublishEvent: | ||
enum: [] | ||
source: | ||
openapi: asyncapi.yml | ||
channel: | ||
auth: false | ||
examples: | ||
- messages: [] | ||
messages: | ||
publish: | ||
body: TestChannelPublishEvent | ||
origin: client | ||
path: /test | ||
url: websocket |
15 changes: 15 additions & 0 deletions
15
...ts/write-definition/fixtures/multiple-no-endpoint-async/fern/.definition/testChannel2.yml
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,15 @@ | ||
types: | ||
TestChannel2PublishEvent: | ||
enum: [] | ||
source: | ||
openapi: asyncapi.yml | ||
channel: | ||
auth: false | ||
examples: | ||
- messages: [] | ||
messages: | ||
publish: | ||
body: TestChannel2PublishEvent | ||
origin: client | ||
path: /test2 | ||
url: websocket2 |
45 changes: 45 additions & 0 deletions
45
...te-tests/src/tests/write-definition/fixtures/multiple-no-endpoint-async/fern/asyncapi.yml
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,45 @@ | ||
asyncapi: 3.0.0 | ||
info: | ||
title: Test AsyncAPI | ||
version: 1.0.0 | ||
servers: | ||
websocket: | ||
host: api.async.com | ||
protocol: wss | ||
websocket2: | ||
host: api2.async.com | ||
protocol: wss | ||
channels: | ||
testChannel: | ||
address: '/test' | ||
servers: | ||
- $ref: '#/servers/websocket' | ||
messages: | ||
sendMessage: | ||
$ref: '#/components/messages/sendMessage' | ||
testChannel2: | ||
address: '/test2' | ||
servers: | ||
- $ref: '#/servers/websocket2' | ||
messages: | ||
sendMessage: | ||
$ref: '#/components/messages/sendMessage' | ||
operations: | ||
send: | ||
action: send | ||
channel: | ||
$ref: '#/channels/testChannel' | ||
messages: | ||
- $ref: '#/channels/testChannel/messages/sendMessage' | ||
send2: | ||
action: send | ||
channel: | ||
$ref: '#/channels/testChannel2' | ||
messages: | ||
- $ref: '#/channels/testChannel2/messages/sendMessage' | ||
components: | ||
messages: | ||
sendMessage: | ||
summary: Message with marked data information. | ||
payload: | ||
type: string |
4 changes: 4 additions & 0 deletions
4
...ests/src/tests/write-definition/fixtures/multiple-no-endpoint-async/fern/fern.config.json
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,4 @@ | ||
{ | ||
"organization": "fern", | ||
"version": "*" | ||
} |
3 changes: 3 additions & 0 deletions
3
...-tests/src/tests/write-definition/fixtures/multiple-no-endpoint-async/fern/generators.yml
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,3 @@ | ||
api: | ||
- path: ./openapi.yml | ||
- path: ./asyncapi.yml |
24 changes: 24 additions & 0 deletions
24
...ete-tests/src/tests/write-definition/fixtures/multiple-no-endpoint-async/fern/openapi.yml
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,24 @@ | ||
openapi: "3.0.0" | ||
info: | ||
version: 1.0.0 | ||
title: Test API | ||
servers: | ||
- url: http://prod.api.com | ||
x-fern-server-name: Prod | ||
- url: http://dev.api.com | ||
x-fern-server-name: Dev | ||
paths: | ||
/pets: | ||
get: | ||
operationId: list | ||
parameters: | ||
- name: limit | ||
schema: | ||
type: integer | ||
responses: | ||
"200": | ||
description: A response | ||
content: | ||
application/json: | ||
schema: | ||
type: string |
19 changes: 19 additions & 0 deletions
19
...src/tests/write-definition/fixtures/multiple-no-endpoint/fern/.definition/__package__.yml
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,19 @@ | ||
service: | ||
auth: false | ||
base-path: '' | ||
endpoints: | ||
list: | ||
auth: false | ||
examples: | ||
- response: | ||
body: string | ||
method: GET | ||
path: /pets | ||
response: | ||
docs: A response | ||
status-code: 200 | ||
type: string | ||
source: | ||
openapi: openapi.yml | ||
source: | ||
openapi: openapi.yml |
8 changes: 8 additions & 0 deletions
8
...e-tests/src/tests/write-definition/fixtures/multiple-no-endpoint/fern/.definition/api.yml
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,8 @@ | ||
default-environment: Prod | ||
display-name: Test API | ||
environments: | ||
Dev: http://dev.api.com | ||
Prod: http://prod.api.com | ||
error-discrimination: | ||
strategy: status-code | ||
name: api |
4 changes: 4 additions & 0 deletions
4
.../ete-tests/src/tests/write-definition/fixtures/multiple-no-endpoint/fern/fern.config.json
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,4 @@ | ||
{ | ||
"organization": "fern", | ||
"version": "*" | ||
} |
2 changes: 2 additions & 0 deletions
2
...li/ete-tests/src/tests/write-definition/fixtures/multiple-no-endpoint/fern/generators.yml
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,2 @@ | ||
api: | ||
- path: ./openapi.yml |
24 changes: 24 additions & 0 deletions
24
...s/cli/ete-tests/src/tests/write-definition/fixtures/multiple-no-endpoint/fern/openapi.yml
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,24 @@ | ||
openapi: "3.0.0" | ||
info: | ||
version: 1.0.0 | ||
title: Test API | ||
servers: | ||
- url: http://prod.api.com | ||
x-fern-server-name: Prod | ||
- url: http://dev.api.com | ||
x-fern-server-name: Dev | ||
paths: | ||
/pets: | ||
get: | ||
operationId: list | ||
parameters: | ||
- name: limit | ||
schema: | ||
type: integer | ||
responses: | ||
"200": | ||
description: A response | ||
content: | ||
application/json: | ||
schema: | ||
type: string |
20 changes: 20 additions & 0 deletions
20
...s/write-definition/fixtures/multiple-with-endpoint-async/fern/.definition/__package__.yml
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,20 @@ | ||
service: | ||
auth: false | ||
base-path: '' | ||
endpoints: | ||
list: | ||
auth: false | ||
examples: | ||
- response: | ||
body: string | ||
method: GET | ||
path: /pets | ||
response: | ||
docs: A response | ||
status-code: 200 | ||
type: string | ||
source: | ||
openapi: openapi.yml | ||
url: Debug | ||
source: | ||
openapi: openapi.yml |
19 changes: 19 additions & 0 deletions
19
...src/tests/write-definition/fixtures/multiple-with-endpoint-async/fern/.definition/api.yml
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,19 @@ | ||
default-environment: Prod | ||
default-url: Base | ||
display-name: Test API | ||
environments: | ||
Dev: | ||
urls: | ||
Base: http://dev.api.com | ||
Debug: http://debug.api.com | ||
websocket: wss://api.async.com | ||
websocket2: wss://api2.async.com | ||
Prod: | ||
urls: | ||
Base: http://prod.api.com | ||
Debug: http://debug.api.com | ||
websocket: wss://api.async.com | ||
websocket2: wss://api2.async.com | ||
error-discrimination: | ||
strategy: status-code | ||
name: api |
15 changes: 15 additions & 0 deletions
15
...s/write-definition/fixtures/multiple-with-endpoint-async/fern/.definition/testChannel.yml
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,15 @@ | ||
types: | ||
TestChannelPublishEvent: | ||
enum: [] | ||
source: | ||
openapi: asyncapi.yml | ||
channel: | ||
auth: false | ||
examples: | ||
- messages: [] | ||
messages: | ||
publish: | ||
body: TestChannelPublishEvent | ||
origin: client | ||
path: /test | ||
url: websocket |
15 changes: 15 additions & 0 deletions
15
.../write-definition/fixtures/multiple-with-endpoint-async/fern/.definition/testChannel2.yml
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,15 @@ | ||
types: | ||
TestChannel2PublishEvent: | ||
enum: [] | ||
source: | ||
openapi: asyncapi.yml | ||
channel: | ||
auth: false | ||
examples: | ||
- messages: [] | ||
messages: | ||
publish: | ||
body: TestChannel2PublishEvent | ||
origin: client | ||
path: /test2 | ||
url: websocket2 |
45 changes: 45 additions & 0 deletions
45
...-tests/src/tests/write-definition/fixtures/multiple-with-endpoint-async/fern/asyncapi.yml
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,45 @@ | ||
asyncapi: 3.0.0 | ||
info: | ||
title: Test AsyncAPI | ||
version: 1.0.0 | ||
servers: | ||
websocket: | ||
host: api.async.com | ||
protocol: wss | ||
websocket2: | ||
host: api2.async.com | ||
protocol: wss | ||
channels: | ||
testChannel: | ||
address: '/test' | ||
servers: | ||
- $ref: '#/servers/websocket' | ||
messages: | ||
sendMessage: | ||
$ref: '#/components/messages/sendMessage' | ||
testChannel2: | ||
address: '/test2' | ||
servers: | ||
- $ref: '#/servers/websocket2' | ||
messages: | ||
sendMessage: | ||
$ref: '#/components/messages/sendMessage' | ||
operations: | ||
send: | ||
action: send | ||
channel: | ||
$ref: '#/channels/testChannel' | ||
messages: | ||
- $ref: '#/channels/testChannel/messages/sendMessage' | ||
send2: | ||
action: send | ||
channel: | ||
$ref: '#/channels/testChannel2' | ||
messages: | ||
- $ref: '#/channels/testChannel2/messages/sendMessage' | ||
components: | ||
messages: | ||
sendMessage: | ||
summary: Message with marked data information. | ||
payload: | ||
type: string |
4 changes: 4 additions & 0 deletions
4
...ts/src/tests/write-definition/fixtures/multiple-with-endpoint-async/fern/fern.config.json
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,4 @@ | ||
{ | ||
"organization": "fern", | ||
"version": "*" | ||
} |
3 changes: 3 additions & 0 deletions
3
...ests/src/tests/write-definition/fixtures/multiple-with-endpoint-async/fern/generators.yml
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,3 @@ | ||
api: | ||
- path: ./openapi.yml | ||
- path: ./asyncapi.yml |
27 changes: 27 additions & 0 deletions
27
...e-tests/src/tests/write-definition/fixtures/multiple-with-endpoint-async/fern/openapi.yml
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,27 @@ | ||
openapi: "3.0.0" | ||
info: | ||
version: 1.0.0 | ||
title: Test API | ||
servers: | ||
- url: http://prod.api.com | ||
x-fern-server-name: Prod | ||
- url: http://dev.api.com | ||
x-fern-server-name: Dev | ||
paths: | ||
/pets: | ||
get: | ||
operationId: list | ||
servers: | ||
- url: http://debug.api.com | ||
x-fern-server-name: Debug | ||
parameters: | ||
- name: limit | ||
schema: | ||
type: integer | ||
responses: | ||
"200": | ||
description: A response | ||
content: | ||
application/json: | ||
schema: | ||
type: string |
20 changes: 20 additions & 0 deletions
20
...c/tests/write-definition/fixtures/multiple-with-endpoint/fern/.definition/__package__.yml
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,20 @@ | ||
service: | ||
auth: false | ||
base-path: '' | ||
endpoints: | ||
list: | ||
auth: false | ||
examples: | ||
- response: | ||
body: string | ||
method: GET | ||
path: /pets | ||
response: | ||
docs: A response | ||
status-code: 200 | ||
type: string | ||
source: | ||
openapi: openapi.yml | ||
url: Debug | ||
source: | ||
openapi: openapi.yml |
Oops, something went wrong.