dtsgenerator
dtsgenerator copied to clipboard
Add operationId as part of Paths
In some situations it might be useful to include the operationId of each operation in the generated types, as a const ID
value.
For example I'm considering writing a dtsgen plugin that emits a map of operationId to request body+response body types, but when the plugin is invoked, the operationId is gone.
Example:
/foo:
post:
operationId: addFoo
...
Current generated type:
namespace AddFoo {
export interface HeaderParameters {
}
namespace Parameters {
}
export type RequestBody = ...
namespace Responses {
export interface $200 {
...
}
}
}
Suggested:
namespace AddFoo {
export const ID = 'addFoo';
export interface HeaderParameters {
}
namespace Parameters {
}
export type RequestBody = ...
namespace Responses {
export interface $200 {
}
}
}
An even more powerful solution might be to include the original JSON schema as part of the context passed to plugins, if possible, then plugins would be able to do more advanced tweaking of the output also using data from the input schema.
This is the kind of content that a plugin would be suited for.