Open jonaskello opened 2 years ago
As a temporary work-around I made this mapped type which allows for extension of SecuritySchemeObject
:
import { OpenAPIV3 } from "openapi-types";
export type DocumentEx<TOperationEx extends {} = {}, TSecuritySchemeEx extends {} = {}> = {
[P in keyof OpenAPIV3.Document<TOperationEx>]: P extends "components"
? MapComponents<OpenAPIV3.Document<TOperationEx>[P], TSecuritySchemeEx>
: OpenAPIV3.Document<TOperationEx>[P];
};
type MapComponents<T, TSecuritySchemeEx extends {}> = {
[P in keyof T]: P extends "securitySchemes" ? MapSecuritySchemes<T[P], TSecuritySchemeEx> : T[P];
};
type MapSecuritySchemes<T, TSecuritySchemeEx extends {}> = {
[P in keyof T]: MapSecuritySchemeObject<T[P], TSecuritySchemeEx>;
};
type MapSecuritySchemeObject<T, TSecuritySchemeEx extends {}> = T extends OpenAPIV3.SecuritySchemeObject
? T & TSecuritySchemeEx
: T;
It seems today extensions such as
x-myexension
is only possible to pass through toOperationObject<T>
by putting it inT
ofDocument<T>
. However openapi v3 supports extensions in the following places according to the docs:Specifically I'm trying to extend
securitySchemes
which does not seem possible today?