Skip to content
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

Wrong Type for StaticDocumentSpec.document in index.d.ts #327

Closed
radzom opened this issue Dec 7, 2020 · 3 comments · Fixed by #328
Closed

Wrong Type for StaticDocumentSpec.document in index.d.ts #327

radzom opened this issue Dec 7, 2020 · 3 comments · Fixed by #328
Labels
good first issue Good for newcomers

Comments

@radzom
Copy link
Contributor

radzom commented Dec 7, 2020

Code checks for an object

if (typeof opts.specification.document !== 'object') return next(new Error('specification.document is not an object'))

but it is defined as a string.

document: string;

@mcollina
Copy link
Member

mcollina commented Dec 8, 2020

Would you like to send a Pull Request to address this issue? Remember to add unit tests.

@radzom
Copy link
Contributor Author

radzom commented Dec 8, 2020

Sure, but i cannot promise any timeframe.

@mcollina mcollina added the good first issue Good for newcomers label Dec 8, 2020
@radzom
Copy link
Contributor Author

radzom commented Dec 8, 2020

Unit test is already there.

test('non-object specification.document throws an error', t => {

Or what test do you want me to write?

I would like to make the type a bit more strict by using the already included SwaggerSchema.Spec (OpenApiV2).
Is there also a type for OpenApiV3 i can use?
I just found this project but am unsure to import it.
https://github.com/kogosoftwarellc/open-api/tree/master/packages/openapi-types#readme
Are there other types that should be supported then?

The easy option would be to just specify the type as 'object' but i think we should do better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants