Skip to content

Commit

Permalink
feat: support multiple servers, change oneOf render
Browse files Browse the repository at this point in the history
  • Loading branch information
v8tenko committed Mar 4, 2024
1 parent 9c7ba51 commit 587d164
Show file tree
Hide file tree
Showing 15 changed files with 519 additions and 221 deletions.
23 changes: 0 additions & 23 deletions .github/workflows/preview.yml

This file was deleted.

21 changes: 16 additions & 5 deletions src/__snapshots__/basic.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,26 @@ exports[`basic openapi project renders description 1`] = `
## Request
<div class="openapi__request__wrapper">
<div class="openapi__requests">
<div class="openapi__request" style="--method: var(--dc-openapi-methods-post)">
POST {.openapi__method}
<div class="openapi__request__wrapper" style="--method: var(--dc-openapi-methods-post);margin-bottom: 12px">
<div class="openapi__request">
POST {.openapi__method}
\`\`\`
http://localhost:8080/test
\`\`\`
</div>
Generated server url
</div>
Generated server url{.openapi__request__description}
</div>
## Responses
Expand All @@ -33,6 +36,8 @@ Generated server url{.openapi__request__description}
Base 200 response
<div class="openapi-entity">
### Body
{% cut "application/json" %}
Expand Down Expand Up @@ -77,12 +82,16 @@ Base 200 response
</div>
</div>
<div class="openapi__response__code__404">
## 404 Not Found
Base 200 response
<div class="openapi-entity">
### Body
{% cut "application/json" %}
Expand Down Expand Up @@ -125,6 +134,8 @@ Base 200 response
|||#
</div>
</div>
<!-- markdownlint-disable-file -->
Expand Down
46 changes: 36 additions & 10 deletions src/__snapshots__/combiners/allOf.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,28 @@ exports[`allOf operator support renders simple allOf 1`] = `
## Request
<div class="openapi__request__wrapper">
<div class="openapi__requests">
<div class="openapi__request" style="--method: var(--dc-openapi-methods-post)">
POST {.openapi__method}
<div class="openapi__request__wrapper" style="--method: var(--dc-openapi-methods-post);margin-bottom: 12px">
<div class="openapi__request">
POST {.openapi__method}
\`\`\`
http://localhost:8080/test
\`\`\`
</div>
Generated server url
</div>
</div>
Generated server url{.openapi__request__description}
<div class="openapi-entity">
### Body
Expand Down Expand Up @@ -77,6 +82,8 @@ Generated server url{.openapi__request__description}
|||#
</div>
## Responses
<div class="openapi__response__code__200">
Expand All @@ -85,6 +92,8 @@ Generated server url{.openapi__request__description}
Base 200 response
<div class="openapi-entity">
### Body
{% cut "application/json" %}
Expand Down Expand Up @@ -135,6 +144,8 @@ Base 200 response
|||#
</div>
</div>
<!-- markdownlint-disable-file -->
Expand All @@ -148,23 +159,28 @@ exports[`allOf operator support renders single allOf 1`] = `
## Request
<div class="openapi__request__wrapper">
<div class="openapi__request" style="--method: var(--dc-openapi-methods-post)">
<div class="openapi__requests">
POST {.openapi__method}
<div class="openapi__request__wrapper" style="--method: var(--dc-openapi-methods-post);margin-bottom: 12px">
<div class="openapi__request">
POST {.openapi__method}
\`\`\`
http://localhost:8080/test
\`\`\`
</div>
Generated server url
</div>
</div>
Generated server url{.openapi__request__description}
<div class="openapi-entity">
### Body
Expand Down Expand Up @@ -201,6 +217,10 @@ Generated server url{.openapi__request__description}
|||#
</div>
<div class="openapi-entity">
### Cat
Cat class
Expand Down Expand Up @@ -231,6 +251,8 @@ Cat class
|||#
</div>
## Responses
<div class="openapi__response__code__200">
Expand All @@ -239,6 +261,8 @@ Cat class
Base 200 response
<div class="openapi-entity">
### Body
{% cut "application/json" %}
Expand Down Expand Up @@ -274,6 +298,8 @@ Base 200 response
|||#
</div>
</div>
<!-- markdownlint-disable-file -->
Expand Down
55 changes: 42 additions & 13 deletions src/__snapshots__/combiners/complex.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,28 @@ exports[`operators complex test renders ok 1`] = `
## Request
<div class="openapi__request__wrapper">
<div class="openapi__requests">
<div class="openapi__request" style="--method: var(--dc-openapi-methods-post)">
POST {.openapi__method}
<div class="openapi__request__wrapper" style="--method: var(--dc-openapi-methods-post);margin-bottom: 12px">
<div class="openapi__request">
POST {.openapi__method}
\`\`\`
http://localhost:8080/test
\`\`\`
</div>
Generated server url
</div>
</div>
Generated server url{.openapi__request__description}
<div class="openapi-entity">
### Body
Expand Down Expand Up @@ -71,15 +76,24 @@ Generated server url{.openapi__request__description}
||
||
...rest
|
oneOf
|
[Dog](#dog)
or [Cat](#cat)
|
Dog class
||
||
oneOf
|
[Cat](#cat)
|
Cat class
|||#
#### Or value from:
</div>
<div class="openapi-entity">
### Dog
Expand Down Expand Up @@ -111,6 +125,10 @@ Dog class
|||#
</div>
<div class="openapi-entity">
### Cat
Cat class
Expand Down Expand Up @@ -141,6 +159,8 @@ Cat class
|||#
</div>
## Responses
<div class="openapi__response__code__200">
Expand All @@ -149,6 +169,8 @@ Cat class
Base 200 response
<div class="openapi-entity">
### Body
{% cut "application/json" %}
Expand Down Expand Up @@ -195,15 +217,22 @@ Base 200 response
||
||
...rest
|
oneOf
|
[Dog](#dog)
or [Cat](#cat)
|
Dog class
||
||
oneOf
|
[Cat](#cat)
|
Cat class
|||#
#### Or value from:
</div>
</div>
<!-- markdownlint-disable-file -->
Expand Down
Loading

0 comments on commit 587d164

Please sign in to comment.