-
Notifications
You must be signed in to change notification settings - Fork 38
fix: openapi3spec update get schema objects #248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,9 @@ | |
"dist" | ||
], | ||
"dependencies": { | ||
"@types/axios": "^0.14.0", | ||
"@types/request": "^2.48.7", | ||
"axios": "^0.21.4", | ||
Comment on lines
+40
to
+42
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, I accidentally didn't include Since we only use it for types, it should be in Also There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good point,
As for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep we'll get that error if we don't have I'm quite curious as to why this error triggers when you run |
||
"combos": "^0.2.0", | ||
"fs-extra": "^9.0.0", | ||
"js-yaml": "^4.0.0", | ||
|
@@ -48,7 +51,6 @@ | |
"devDependencies": { | ||
"@types/fs-extra": "^9.0.12", | ||
"@types/js-yaml": "^4.0.3", | ||
"@types/request": "^2.48.7", | ||
"@types/superagent": "^4.1.12", | ||
"@types/typeof": "^1.0.0", | ||
"openapi-types": "^9.2.0" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @tom-arnold for raising this and submitting a fix! 🙂
I can't reproduce the error. Does this error come from
jestOpenAPI(spec)
ortoSatisfySchemaInApiSpec(foo)
? Would you mind showing how you're triggering this error and your full stack trace? Also your tsconfig and OpenAPI doc version please.For fastest resolution, please recreate this in our recreation template.
I ask because I'm not sure how your change fixes the error. I assume you want
'{ [key: string]: ReferenceObject | SchemaObject; } | undefined'
to change to'{ [key: string]: ReferenceObject | SchemaObject; }'
.But given
OpenAPIV3.ComponentsObject
has type:OpenAPIV3.ComponentsObject['schemas']
is{ [key: string]: ReferenceObject | SchemaObject; } | undefined
,whereas
Pick<OpenAPIV3.ComponentsObject, 'schemas'>
iswhich does not match the actual value
this.getComponentDefinitions().schemas
. This seems wrong to me, so I wonder if it fixes your error by breaking something, so TypeScript acceptsany
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tom-arnold I saw this error when I enabled TypeScript's strict mode, so I wonder if it will be fixed by https://github.com/openapi-library/OpenAPIValidators/pull/254/files#diff-f24b64aecef0d95e0a629f3f7ba7ea12fd4f2ef959ec61b82448a54fe309bbe2R15.
It'd be great to know exactly what error you're seeing:
jestOpenAPI(spec)
ortoSatisfySchemaInApiSpec(foo)
?