-
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.
fix: figure out a way to uniquely identify shallow copies produced by…
… `merge`
- Loading branch information
1 parent
add2c31
commit 65b497d
Showing
6 changed files
with
376 additions
and
4 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,288 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Recursive references in schemas resulting in a cycle between two components are able to be handled by the includer 1`] = ` | ||
"<div class="openapi"> | ||
# recursiveReferences | ||
## Request | ||
<div class="openapi__requests"> | ||
<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> | ||
## Responses | ||
<div class="openapi__response__code__200"> | ||
## 200 OK | ||
<div class="openapi-entity"> | ||
### Body | ||
{% cut "application/json" %} | ||
\`\`\`json | ||
{ | ||
"A": { | ||
"B": {} | ||
} | ||
} | ||
\`\`\` | ||
{% endcut %} | ||
#||| | ||
**Name** | ||
| | ||
**Description** | ||
|| | ||
|| | ||
A | ||
| | ||
**Type:** [RecurseMiddle](#recursemiddle) | ||
|||# | ||
</div> | ||
<div class="openapi-entity"> | ||
### RecurseMiddle | ||
#||| | ||
**Name** | ||
| | ||
**Description** | ||
|| | ||
|| | ||
B | ||
| | ||
**Type:** [RecurseTop](#recursetop) | ||
|||# | ||
</div> | ||
<div class="openapi-entity"> | ||
### RecurseTop | ||
#||| | ||
**Name** | ||
| | ||
**Description** | ||
|| | ||
|| | ||
A | ||
| | ||
**Type:** [RecurseMiddle](#recursemiddle) | ||
|||# | ||
</div> | ||
</div> | ||
<!-- markdownlint-disable-file --> | ||
</div>" | ||
`; | ||
|
||
exports[`Recursive references in schemas resulting in a trivial self-referential cycle are able to be handled by the includer 1`] = ` | ||
"<div class="openapi"> | ||
# recursiveReferences | ||
## Request | ||
<div class="openapi__requests"> | ||
<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> | ||
## Responses | ||
<div class="openapi__response__code__200"> | ||
## 200 OK | ||
<div class="openapi-entity"> | ||
### Body | ||
{% cut "application/json" %} | ||
\`\`\`json | ||
{ | ||
"A": {} | ||
} | ||
\`\`\` | ||
{% endcut %} | ||
#||| | ||
**Name** | ||
| | ||
**Description** | ||
|| | ||
|| | ||
A | ||
| | ||
**Type:** [RecurseTop](#recursetop) | ||
|||# | ||
</div> | ||
<div class="openapi-entity"> | ||
### RecurseTop | ||
#||| | ||
**Name** | ||
| | ||
**Description** | ||
|| | ||
|| | ||
A | ||
| | ||
**Type:** [RecurseTop](#recursetop) | ||
|||# | ||
</div> | ||
</div> | ||
<!-- markdownlint-disable-file --> | ||
</div>" | ||
`; | ||
|
||
exports[`Recursive references in schemas where the cycle itself is not trivially referenced are able to be handled by the includer 1`] = ` | ||
"<div class="openapi"> | ||
# recursiveReferences | ||
## Request | ||
<div class="openapi__requests"> | ||
<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> | ||
## Responses | ||
<div class="openapi__response__code__200"> | ||
## 200 OK | ||
<div class="openapi-entity"> | ||
### Body | ||
{% cut "application/json" %} | ||
\`\`\`json | ||
{ | ||
"A": {} | ||
} | ||
\`\`\` | ||
{% endcut %} | ||
#||| | ||
**Name** | ||
| | ||
**Description** | ||
|| | ||
|| | ||
A | ||
| | ||
**Type:** [RecurseTop](#recursetop) | ||
|||# | ||
</div> | ||
<div class="openapi-entity"> | ||
### RecurseTop | ||
#||| | ||
**Name** | ||
| | ||
**Description** | ||
|| | ||
|| | ||
A | ||
| | ||
**Type:** [RecurseTop](#recursetop) | ||
|||# | ||
</div> | ||
</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,73 @@ | ||
import {DocumentBuilder, run} from './__helpers__/run'; | ||
|
||
const name = 'recursiveReferences'; | ||
|
||
describe('Recursive references in schemas', () => { | ||
it('resulting in a cycle between two components are able to be handled by the includer', async () => { | ||
const spec = new DocumentBuilder(name) | ||
.component('RecurseTop', { | ||
type: 'object', | ||
properties: { | ||
A: DocumentBuilder.ref('RecurseMiddle'), | ||
}, | ||
}) | ||
.component('RecurseMiddle', { | ||
type: 'object', | ||
properties: { | ||
B: DocumentBuilder.ref('RecurseTop'), | ||
}, | ||
}) | ||
.response(200, { | ||
schema: DocumentBuilder.ref('RecurseTop'), | ||
}) | ||
.build(); | ||
|
||
const fs = await run(spec); | ||
|
||
const page = fs.match(name); | ||
|
||
expect(page).toMatchSnapshot(); | ||
}); | ||
|
||
it('resulting in a trivial self-referential cycle are able to be handled by the includer', async () => { | ||
const spec = new DocumentBuilder(name) | ||
.component('RecurseTop', { | ||
type: 'object', | ||
properties: { | ||
A: DocumentBuilder.ref('RecurseTop'), | ||
}, | ||
}) | ||
.response(200, { | ||
schema: DocumentBuilder.ref('RecurseTop'), | ||
}) | ||
.build(); | ||
|
||
const fs = await run(spec); | ||
|
||
const page = fs.match(name); | ||
|
||
expect(page).toMatchSnapshot(); | ||
}); | ||
|
||
test('where the cycle itself is not trivially referenced are able to be handled by the includer', async () => { | ||
const spec = new DocumentBuilder(name) | ||
.component('RecurseTop', { | ||
type: 'object', | ||
properties: { | ||
A: DocumentBuilder.ref('RecurseTop'), | ||
}, | ||
}) | ||
.response(200, { | ||
schema: { | ||
allOf: [DocumentBuilder.ref('RecurseTop', 'Description override')], | ||
}, | ||
}) | ||
.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
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
Oops, something went wrong.