Skip to content

Commit

Permalink
feat: refactor, oneOf/allOf fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
v8tenko committed Nov 10, 2023
1 parent 486729b commit dbb8e11
Show file tree
Hide file tree
Showing 20 changed files with 388 additions and 376 deletions.
14 changes: 0 additions & 14 deletions .eslintrc

This file was deleted.

15 changes: 15 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = {
extends: ['@diplodoc/eslint-config', '@diplodoc/eslint-config/prettier'],
root: true,
overrides: [
{
files: ['*.ts', '*.tsx'],
parser: '@typescript-eslint/parser',
parserOptions: {
sourceType: 'module',
project: ['./tsconfig.test.json', './tsconfig.json'],
tsconfigRootDir: __dirname,
},
},
],
};
102 changes: 23 additions & 79 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
},
"dependencies": {
"@apidevtools/swagger-parser": "^10.1.0",
"@diplodoc/transform": "^4.2.1",
"@diplodoc/transform": "^4.3.0",
"bem-cn-lite": "^4.1.0",
"html-escaper": "^3.0.3",
"http-status-codes": "^2.2.0",
Expand Down
14 changes: 6 additions & 8 deletions src/__snapshots__/combiners/complex.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ Generated server url{.openapi__request__description}
\`\`\`json
{
"name": "b",
"age": 0
"name": "b"
}
\`\`\`
Expand All @@ -45,9 +44,9 @@ Generated server url{.openapi__request__description}
|| name | string | <span style="color:gray;">Default</span>: \`b\` ||
|| age | number, boolean | ||
|| age | any | ||
|| ...rest | oneOf | [Dog](#dog)
|| ...rest | oneOf | [Dog](#dog)
or [Cat](#cat) |||#
#### Or value from:
Expand Down Expand Up @@ -87,8 +86,7 @@ Base 200 response
\`\`\`json
{
"name": "b",
"age": 0
"name": "b"
}
\`\`\`
Expand All @@ -100,9 +98,9 @@ Base 200 response
|| name | string | <span style="color:gray;">Default</span>: \`b\` ||
|| age | number, boolean | ||
|| age | any | ||
|| ...rest | oneOf | [Dog](#dog)
|| ...rest | oneOf | [Dog](#dog)
or [Cat](#cat) |||#
#### Or value from:
Expand Down
43 changes: 29 additions & 14 deletions src/__snapshots__/combiners/oneOf.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ Generated server url{.openapi__request__description}
\`\`\`json
{}
{
"type": "string",
"baz": "string"
}
\`\`\`
Expand All @@ -40,7 +43,7 @@ Generated server url{.openapi__request__description}
#||| **Name** | **Type** | **Description** ||
|| ...rest | oneOf | [Dog](#dog)
|| ...rest | oneOf | [Dog](#dog)
or [Cat](#cat) |||#
#### Or value from:
Expand Down Expand Up @@ -77,7 +80,10 @@ Cat class
\`\`\`json
{}
{
"type": "string",
"baz": "string"
}
\`\`\`
Expand All @@ -86,7 +92,8 @@ Cat class
#||| **Name** | **Type** | **Description** ||
|| ...rest | oneOf | [Dog](#dog)
|| ...rest | oneOf | Base 200 response
[Dog](#dog)
or [Cat](#cat) |||#
#### Or value from:
Expand Down Expand Up @@ -144,7 +151,7 @@ Generated server url{.openapi__request__description}
|| age | number | ||
|| ...rest | oneOf | [Dog](#dog)
|| ...rest | oneOf | [Dog](#dog)
or [Cat](#cat) |||#
#### Or value from:
Expand Down Expand Up @@ -197,7 +204,8 @@ Cat class
|| age | number | ||
|| ...rest | oneOf | [Dog](#dog)
|| ...rest | oneOf | Base 200 response
[Dog](#dog)
or [Cat](#cat) |||#
#### Or value from:
Expand Down Expand Up @@ -240,7 +248,10 @@ Generated server url{.openapi__request__description}
\`\`\`json
{
"pet": {}
"pet": {
"type": "string",
"baz": "string"
}
}
\`\`\`
Expand All @@ -250,10 +261,10 @@ Generated server url{.openapi__request__description}
#||| **Name** | **Type** | **Description** ||
|| pet | object | [Dog](#dog)
or [Cat](#cat) ||
|| pet | [Dog](#dog)
or [Cat](#cat) | ||
|| ...rest | oneOf | [Dog](#dog)
|| ...rest | oneOf | [Dog](#dog)
or [Cat](#cat) |||#
#### Or value from:
Expand Down Expand Up @@ -291,7 +302,10 @@ Cat class
\`\`\`json
{
"pet": {}
"pet": {
"type": "string",
"baz": "string"
}
}
\`\`\`
Expand All @@ -301,10 +315,11 @@ Cat class
#||| **Name** | **Type** | **Description** ||
|| pet | object | [Dog](#dog)
or [Cat](#cat) ||
|| pet | [Dog](#dog)
or [Cat](#cat) | ||
|| ...rest | oneOf | [Dog](#dog)
|| ...rest | oneOf | Base 200 response
[Dog](#dog)
or [Cat](#cat) |||#
#### Or value from:
Expand Down
2 changes: 1 addition & 1 deletion src/__snapshots__/description.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Generated server url{.openapi__request__description}
{% cut "application/json" %}
\`\`\`
\`\`\`json
{
"pet": {
"type": "string",
Expand Down
6 changes: 0 additions & 6 deletions src/includer/generators/index.ts

This file was deleted.

Loading

0 comments on commit dbb8e11

Please sign in to comment.