Having a hard time trying to figure out the "right" way of doing this. I'm using Micronaut to create a REST service that uses OpenAPI/Swagger by transforming my API annotations into open API specs. I'm trying to eliminate annotation duplication between APIs that take the same parameters in.
@Operation(
operationId = "...",
summary = "..",
description = "...",
)
@Post(uri = "something/{object_type}")
fun apiA(@Parameter(name = "", description = "") object_type: String) {
}
@Post(uri = "something-else/{object_type}")
// This should have the same @Parameter as the above api but I don't want to copy/paste
fun apiB(object_type: String) {}
I've tried to create my own annotation that has @Parameter
on it but it doesn't seem to inherit. I know OpenAPI has a "component" concept but I'm not sure where my particular framework wants me to define components. Any pointers would be greatly appreciated.