-
Notifications
You must be signed in to change notification settings - Fork 92
Open
Description
I tried to configure the authentication part of the openAPI documentation with the following config:
app.use(
'/api',
useSofa({
schema,
basePath: '/api',
openAPI: {
components: {
securitySchemes: {
ApiKeyAuth: {
type: 'apiKey',
in: 'header',
name: 'authorization',
},
},
},
security: [
{
ApiKeyAuth: [],
},
],
},
})
);
But typescript gives the following error:
Type '{ components: { securitySchemes: { ApiKeyAuth: { type: string; in: string; name: string; }; }; }; security: { ApiKeyAuth: never[]; }[]; }' is not assignable to type 'RouterOpenAPIOptions<any>'.
Object literal may only specify known properties, and 'security' does not exist in type 'RouterOpenAPIOptions<any>'.ts(2322)
sofa.d.ts(37, 5): The expected type comes from property 'openAPI' which is declared here on type 'SofaConfig'
The security parameter works fine if I do some "hacking" and suppress typescript errors, so then I guess this is just the issue with types. I am on v0.18.0.
mi-mihajlovic-levi9-com, FreeRiderBysik and C-D-Lewis
Metadata
Metadata
Assignees
Labels
No labels