Elizabeth Thomas
02/18/2021, 4:57 AMOpenApiExtension
for the paths
in OpenApi spec through http4k-contract? My scenario is that I want to be able to add a custom attribute with a value to every path in my OpenApi Spec. I was able to add a custom attribute block using OpenApiExtension to the extensions
field in OpenApi3
. But I am not sure how to do it for each of my path object
apiBaseUrl bind contract {
renderer = OpenApi3(
ApiInfo(apiName, apiVersion, apiName),
WdsHttpJackson,
listOf(XApiDefinitionExtension),
OpenApi3ApiRenderer(WdsHttpJackson)
)
descriptionPath = swaggerJsonPath
routes += contractRoutes
}
paths
object something like this
...
"paths": {
"/abc": {
"x-custom-classification": "INTERNAL",
"get": {
...
}
},
"/def": {
"x-custom-classification": "PUBLIC",
"get": {
...
}
}
}
...
x-custom-classification
attribute to the open api spec for every path using OpenApiExtensions?Path Item Object
in OpenAPI3 Spec MAY be extended with OpenAPI Extensions
dave
02/18/2021, 2:36 PMElizabeth Thomas
02/18/2021, 3:15 PM"/echo" meta {
summary = "echoes the name and message sent to it"
receiving(body to NameAndMessage("jim", "hello!"))
returning(OK, body to NameAndMessage("jim", "hello!"))
} bindContract POST to { request: Request ->
val received: NameAndMessage = body(request)
Response(OK).with(body of received)
}
dave
02/18/2021, 3:16 PMhttp4k-contract/src/test/resources/org/http4k/contract/openapi/v3/OpenApi3AutoTest.renders as expected.approved
Elizabeth Thomas
02/18/2021, 3:45 PMdave
02/18/2021, 4:37 PMElizabeth Thomas
02/18/2021, 4:43 PM