Skip to content

Commit

Permalink
Merge pull request #15 from diplodoc-platform/coloring
Browse files Browse the repository at this point in the history
feat: new colors
  • Loading branch information
v8tenko authored Sep 21, 2023
2 parents 590819e + 58fd3a8 commit c64c10f
Show file tree
Hide file tree
Showing 12 changed files with 369 additions and 143 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: OpenAPI preview

on:
pull_request:

jobs:
preview:
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
steps:
- uses: actions/checkout@v4
with:
repository: "v8tenko/diplodoc-playground"
- name: Use Node.js 14
uses: actions/setup-node@v3
with:
node-version: 14
- name: Diplodoc build action
uses: v8tenko/[email protected]
with:
token: ${{secrets.GITHUB_TOKEN}}
36 changes: 23 additions & 13 deletions src/__snapshots__/basic.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,28 @@ exports[`basic openapi project renders description 1`] = `
## Request
#||| **method** | **url** | **description** ||
<div class="openapi__request__wrapper">
<div class="openapi__request" style="--method: var(--dc-openapi-methods-post)">
POST {.openapi__method}
||
\`\`\`
POST
\`\`\`
|
\`\`\`
http://localhost:8080/test
\`\`\`
|
\`\`\`
Generated server url
\`\`\`
|||#
</div>
</div>
Generated server url{.openapi__request__description}
## Responses
<div class="openapi__response__code__200">
## 200 OK
Base 200 response
Expand All @@ -34,7 +38,7 @@ Base 200 response
{% cut "application/json" %}
\`\`\`
\`\`\`json
{
"type": "string",
"foo": "string"
Expand All @@ -51,6 +55,10 @@ Base 200 response
|| foo | string | |||#
</div>
<div class="openapi__response__code__404">
## 404 Not Found
Base 200 response
Expand All @@ -60,7 +68,7 @@ Base 200 response
{% cut "application/json" %}
\`\`\`
\`\`\`json
{
"type": "string",
"bar": "string"
Expand All @@ -76,6 +84,8 @@ Base 200 response
|| type | string | ||
|| bar | string | |||#
</div>
<!-- markdownlint-disable-file -->
</div>"
Expand Down
64 changes: 38 additions & 26 deletions src/__snapshots__/combiners/allOf.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,30 @@ exports[`allOf operator support renders simple allOf 1`] = `
## Request
#||| **method** | **url** | **description** ||
<div class="openapi__request__wrapper">
<div class="openapi__request" style="--method: var(--dc-openapi-methods-post)">
POST {.openapi__method}
||
\`\`\`
POST
\`\`\`
|
\`\`\`
http://localhost:8080/test
\`\`\`
|
\`\`\`
Generated server url
\`\`\`
|||#
</div>
</div>
Generated server url{.openapi__request__description}
#### Body
{% cut "application/json" %}
\`\`\`
\`\`\`json
{
"type": "string",
"foo": "string",
Expand All @@ -50,6 +52,8 @@ Generated server url
## Responses
<div class="openapi__response__code__200">
## 200 OK
Base 200 response
Expand All @@ -59,7 +63,7 @@ Base 200 response
{% cut "application/json" %}
\`\`\`
\`\`\`json
{
"type": "string",
"baz": "string"
Expand All @@ -77,6 +81,8 @@ Base 200 response
|| type | string | ||
|| baz | string | |||#
</div>
<!-- markdownlint-disable-file -->
</div>"
Expand All @@ -89,28 +95,30 @@ exports[`allOf operator support renders single allOf 1`] = `
## Request
#||| **method** | **url** | **description** ||
<div class="openapi__request__wrapper">
<div class="openapi__request" style="--method: var(--dc-openapi-methods-post)">
POST {.openapi__method}
||
\`\`\`
POST
\`\`\`
|
\`\`\`
http://localhost:8080/test
\`\`\`
|
\`\`\`
Generated server url
\`\`\`
|||#
</div>
</div>
Generated server url{.openapi__request__description}
#### Body
{% cut "application/json" %}
\`\`\`
\`\`\`json
{
"pet": {
"type": "string",
Expand Down Expand Up @@ -139,6 +147,8 @@ Cat class
## Responses
<div class="openapi__response__code__200">
## 200 OK
Base 200 response
Expand All @@ -148,7 +158,7 @@ Base 200 response
{% cut "application/json" %}
\`\`\`
\`\`\`json
{
"pet": {
"type": "string",
Expand All @@ -164,6 +174,8 @@ Base 200 response
#||| **Name** | **Type** | **Description** ||
|| pet | [Cat](#cat) | Cat class |||#
</div>
<!-- markdownlint-disable-file -->
</div>"
Expand Down
32 changes: 19 additions & 13 deletions src/__snapshots__/combiners/complex.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,30 @@ exports[`basic openapi project renders description 1`] = `
## Request
#||| **method** | **url** | **description** ||
<div class="openapi__request__wrapper">
<div class="openapi__request" style="--method: var(--dc-openapi-methods-post)">
POST {.openapi__method}
||
\`\`\`
POST
\`\`\`
|
\`\`\`
http://localhost:8080/test
\`\`\`
|
\`\`\`
Generated server url
\`\`\`
|||#
</div>
</div>
Generated server url{.openapi__request__description}
#### Body
{% cut "application/json" %}
\`\`\`
\`\`\`json
{
"name": "b",
"age": 0
Expand Down Expand Up @@ -72,6 +74,8 @@ Cat class
## Responses
<div class="openapi__response__code__200">
## 200 OK
Base 200 response
Expand All @@ -81,7 +85,7 @@ Base 200 response
{% cut "application/json" %}
\`\`\`
\`\`\`json
{
"name": "b",
"age": 0
Expand All @@ -102,6 +106,8 @@ Base 200 response
or [Cat](#cat) |||#
#### Or value from:
</div>
<!-- markdownlint-disable-file -->
</div>"
Expand Down
Loading

0 comments on commit c64c10f

Please sign in to comment.