-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c483dbe
commit 4332d2b
Showing
3 changed files
with
168 additions
and
0 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,92 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`length renders correct length limits 1`] = ` | ||
"<div class="openapi"> | ||
# length | ||
## Request | ||
<div class="openapi__request__wrapper"> | ||
<div class="openapi__request" style="--method: var(--dc-openapi-methods-post)"> | ||
POST {.openapi__method} | ||
\`\`\` | ||
http://localhost:8080/test | ||
\`\`\` | ||
</div> | ||
</div> | ||
Generated server url{.openapi__request__description} | ||
## Responses | ||
<div class="openapi__response__code__200"> | ||
## 200 OK | ||
### Body | ||
{% cut "application/json" %} | ||
\`\`\`json | ||
{ | ||
"pet": { | ||
"name": "string", | ||
"foo": "string" | ||
}, | ||
"petWithoutDescription": { | ||
"name": "string", | ||
"foo": "string" | ||
}, | ||
"refToSchemaWithDescription": { | ||
"name": "string", | ||
"bar": "string" | ||
} | ||
} | ||
\`\`\` | ||
{% endcut %} | ||
#||| **Name** | **Type** | **Description** || | ||
|| pet | [Cat](#cat) | From response || | ||
|| petWithoutDescription | [Cat](#cat) | Cat class || | ||
|| refToSchemaWithDescription | [Dog](#dog) | Dog class |||# | ||
### Cat | ||
Cat class | ||
#||| **Name** | **Type** | **Description** || | ||
|| name | string | || | ||
|| foo | string | <span style="color:gray;">Min length</span>: \`3\` |||# | ||
### Dog | ||
Dog class | ||
#||| **Name** | **Type** | **Description** || | ||
|| name | string | Pet name<br><span style="color:gray;">Max length</span>: \`100\` || | ||
|| bar | string | <span style="color:gray;">Min length</span>: \`1\`<br><span style="color:gray;">Max length</span>: \`99\` |||# | ||
</div> | ||
<!-- markdownlint-disable-file --> | ||
</div>" | ||
`; |
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,63 @@ | ||
import {DocumentBuilder, run} from './__helpers__/run'; | ||
|
||
const name = 'length'; | ||
describe('length', () => { | ||
it('renders correct length limits', async () => { | ||
const spec = new DocumentBuilder(name) | ||
.component('Pet', { | ||
allOf: [DocumentBuilder.ref('Cat', 'From allOf in Pet')], | ||
description: 'From pet', | ||
}) | ||
.component('Cat', { | ||
type: 'object', | ||
properties: { | ||
name: { | ||
type: 'string', | ||
}, | ||
foo: { | ||
type: 'string', | ||
minLength: 3, | ||
}, | ||
}, | ||
description: 'Cat class', | ||
}) | ||
.component('Dog', { | ||
type: 'object', | ||
properties: { | ||
name: { | ||
type: 'string', | ||
description: 'Pet name', | ||
maxLength: 100, | ||
}, | ||
bar: { | ||
type: 'string', | ||
minLength: 1, | ||
maxLength: 99, | ||
}, | ||
}, | ||
description: 'Dog class', | ||
}) | ||
.response(200, { | ||
schema: { | ||
properties: { | ||
pet: { | ||
allOf: [DocumentBuilder.ref('Pet', 'From response')], | ||
}, | ||
petWithoutDescription: { | ||
allOf: [DocumentBuilder.ref('Cat')], | ||
}, | ||
refToSchemaWithDescription: { | ||
allOf: [DocumentBuilder.ref('Dog')], | ||
}, | ||
}, | ||
}, | ||
}) | ||
.build(); | ||
|
||
const fs = await run(spec); | ||
|
||
const page = fs.match(name); | ||
|
||
expect(page).toMatchSnapshot(); | ||
}); | ||
}); |
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