openapi: proper typing for actuator/info

This commit is contained in:
Gauthier Roebroeck 2025-06-30 11:42:56 +08:00
parent 9a6b643876
commit bf2484419d
4 changed files with 13 additions and 2 deletions

View file

@ -186,6 +186,10 @@
"Example": {
"value": "{\n \"git\": {\n \"branch\": \"master\",\n \"commit\": {\n \"id\": \"9be980d\",\n \"time\": \"2025-03-12T03:40:38Z\"\n }\n },\n \"build\": {\n \"artifact\": \"komga\",\n \"name\": \"komga\",\n \"version\": \"1.21.2\",\n \"group\": \"komga\"\n },\n \"java\": {\n \"version\": \"23.0.2\",\n \"vendor\": {\n \"name\": \"Eclipse Adoptium\",\n \"version\": \"Temurin-23.0.2+7\"\n },\n \"runtime\": {\n \"name\": \"OpenJDK Runtime Environment\",\n \"version\": \"23.0.2+7\"\n },\n \"jvm\": {\n \"name\": \"OpenJDK 64-Bit Server VM\",\n \"vendor\": \"Eclipse Adoptium\",\n \"version\": \"23.0.2+7\"\n }\n },\n \"os\": {\n \"name\": \"Linux\",\n \"version\": \"6.8.0-57-generic\",\n \"arch\": \"amd64\"\n }\n}"
}
},
"schema": {
"type": "object",
"additionalProperties": true
}
}
},

View file

@ -10,6 +10,7 @@ import io.swagger.v3.oas.models.info.Info
import io.swagger.v3.oas.models.info.License
import io.swagger.v3.oas.models.media.Content
import io.swagger.v3.oas.models.media.MediaType
import io.swagger.v3.oas.models.media.Schema
import io.swagger.v3.oas.models.responses.ApiResponse
import io.swagger.v3.oas.models.responses.ApiResponses
import io.swagger.v3.oas.models.security.SecurityRequirement
@ -193,6 +194,10 @@ class OpenApiConfiguration(
.addMediaType(
"application/json",
MediaType()
.schema(Schema<Map<String, Any>>().apply {
type = "object"
additionalProperties = true
})
.addExamples(
"Example",
Example()

View file

@ -4125,7 +4125,9 @@ export interface operations {
[name: string]: unknown;
};
content: {
"application/json": unknown;
"application/json": {
[key: string]: unknown;
};
};
};
};

View file

@ -38,5 +38,5 @@ export const actuatorInfo = {
}
export const actuatorHandlers = [
httpTyped.get('/actuator/info', ({ response }) => response(200).json(actuatorInfo as never)),
httpTyped.get('/actuator/info', ({ response }) => response(200).json(actuatorInfo)),
]