Skip to content

Commit

Permalink
bugfix: deepcopy before validation to deal with APIDevTools/swagger-p…
Browse files Browse the repository at this point in the history
  • Loading branch information
spokli committed Jan 3, 2024
1 parent 130f49f commit 805c3a3
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 14 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
/dist3/
/.idea/
/.history/
/*.iml
/*.iml
.vscode
15 changes: 10 additions & 5 deletions examples/unified-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,6 @@ paths:

components:
schemas:

StatusResponse:
title: StatusResponse
required:
Expand Down Expand Up @@ -309,10 +308,7 @@ components:
pattern: ^[A-Z]{2}$
description: ISO 3166-1 alpha-2, e.g. DE, EN
language:
type: string
maxLength: 2
description: Language of the tracking
enum: [DE, EN]
$ref: '#/components/schemas/Language'

OffsetInfoRequest:
title: OffsetInfoRequest
Expand Down Expand Up @@ -400,6 +396,8 @@ components:
booleanType:
$ref: '#/components/schemas/BooleanType'
primitiveAnyType: {}
language:
$ref: '#/components/schemas/Language'

AnyType: {}
StringType:
Expand All @@ -411,6 +409,13 @@ components:
BooleanType:
type: boolean

Language:
type: string
maxLength: 2
description: Language of the tracking
enum: [DE, EN]


securitySchemes:
bearerAuth:
type: http
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@
"openapi-types": "^12.1.3",
"st-cp": "^2.0.0-beta.2",
"st-rm-rf": "^2.0.0-beta.1",
"typescript": "^3.8.3",
"typescript": "^4.6.3",
"valid-url": "^1.0.9",
"yaml": "^1.10.2"
},
"devDependencies": {
"@types/mustache": "^4.0.1",
"@types/node": "^13.11.1",
"@types/node": "^18.15.0",
"@types/node-fetch": "^2.5.6"
},
"bundledDependencies": [
Expand Down
2 changes: 1 addition & 1 deletion src/action/execute-generation-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export const executeGenerationAction = async () => {
}

try {
const valid = await validate(openApiSpec);
const valid = await validate(structuredClone(openApiSpec));

if (isDebug) {
console.log('OpenApi JSON is valid :', valid);
Expand Down
22 changes: 17 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,18 @@
"@types/node" "*"
form-data "^3.0.0"

"@types/node@*", "@types/node@^13.11.1":
"@types/node@*":
version "13.11.1"
resolved "https://registry.yarnpkg.com/@types/node/-/node-13.11.1.tgz#49a2a83df9d26daacead30d0ccc8762b128d53c7"
integrity sha512-eWQGP3qtxwL8FGneRrC5DwrJLGN4/dH1clNTuLfN81HCrxVtxRjygDTUoZJ5ASlDEeo0ppYFQjQIlXhtXpOn6g==

"@types/node@^18.15.0":
version "18.19.4"
resolved "https://registry.yarnpkg.com/@types/node/-/node-18.19.4.tgz#89672e84f11a2c19543d694dac00ab8d7bc20ddb"
integrity sha512-xNzlUhzoHotIsnFoXmJB+yWmBvFZgKCI9TtPIEdYIMM1KWfwuY8zh7wvc1u1OAXlC7dlf6mZVx/s+Y5KfFz19A==
dependencies:
undici-types "~5.26.4"

ajv-draft-04@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/ajv-draft-04/-/ajv-draft-04-1.0.0.tgz#3b64761b268ba0b9e668f0b41ba53fce0ad77fc8"
Expand Down Expand Up @@ -291,10 +298,15 @@ tr46@~0.0.3:
resolved "https://registry.yarnpkg.com/tr46/-/tr46-0.0.3.tgz#8184fd347dac9cdc185992f3a6622e14b9d9ab6a"
integrity sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=

typescript@^3.8.3:
version "3.8.3"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.8.3.tgz#409eb8544ea0335711205869ec458ab109ee1061"
integrity sha512-MYlEfn5VrLNsgudQTVJeNaQFUAI7DkhnOjdpAp4T+ku1TfQClewlbSuTVHiA+8skNBgaf02TL/kLOvig4y3G8w==
typescript@^4.6.3:
version "4.9.5"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a"
integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==

undici-types@~5.26.4:
version "5.26.5"
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617"
integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==

uri-js@^4.2.2:
version "4.4.1"
Expand Down

0 comments on commit 805c3a3

Please sign in to comment.