You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
openapi: replace custom Jackson mappers with swagger-core Json/Yaml utilities
OpenAPI spec serialization now delegates entirely to io.swagger.v3.core.util.Json
and io.swagger.v3.core.util.Yaml rather than constructing custom ObjectMappers.
This removes all direct Jackson imports from OpenApiSpecGenerator; Jackson remains
on the classpath transitively from swagger-core.
swagger-core's ObjectMapperFactory already configures NON_NULL, disables
WRITE_DATES_AS_TIMESTAMPS, and disables FAIL_ON_EMPTY_BEANS — the same settings
we had manually, now handled by the library. Pretty vs compact output is selected
at serialization time via Json.pretty()/Yaml.pretty() vs mapper().writeValueAsString().
Tests: add testPrettyAndCompactJsonOutput and testPrettyAndCompactYamlOutput to
exercise both branches of the isPrettyPrint() path through the swagger-core utilities.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
-**Request body schema** — all operations are typed as `object` because Axis2 JSON-RPC services use `JsonRpcMessageReceiver` and have no annotation-level parameter metadata. Schema details must be added via `OpenApiCustomizer` or by serving a static schema file.
184
184
-**GET operations** — all operations are mapped to `POST`; override via `OpenApiCustomizer` if GET endpoints are needed.
185
-
-**YAML format** — uses `jackson-dataformat-yaml`(transitive from `swagger-core`); no additional dependency required.
185
+
-**YAML format** — delegates to `io.swagger.v3.core.util.Yaml`, which uses `jackson-dataformat-yaml`internally; no additional dependency required.
// OpenAPI spec serialization delegates entirely to swagger-core's Json/Yaml utilities,
98
+
// which already configure NON_NULL, WRITE_DATES_AS_TIMESTAMPS=false, and FAIL_ON_EMPTY_BEANS=false
99
+
// on their internal Jackson mapper. No direct Jackson dependency is needed in this class.
130
100
131
-
// Initialize Moshi for general JSON operations (preferred over Jackson where possible)
101
+
// Initialize Moshi for general JSON operations (Axis2 preference)
132
102
this.moshi = newMoshi.Builder()
133
103
.add(Date.class, newRfc3339DateJsonAdapter())
134
104
.build();
135
105
136
106
// Initialize performance metrics from moshih2 package for HTTP/2 optimization tracking
137
107
this.metrics = newJsonProcessingMetrics();
138
108
139
-
log.info("OpenAPI JSON processing configured with Moshi + Jackson hybrid approach (Jackson only for Swagger model serialization, Moshi preferred for other JSON operations, moshih2 performance tracking enabled)");
109
+
log.info("OpenAPI spec generator configured: swagger-core Json/Yaml utilities for spec serialization, Moshi for general JSON, moshih2 HTTP/2 metrics enabled");
140
110
}
141
111
142
112
/**
@@ -180,24 +150,19 @@ public String generateOpenApiJson(HttpServletRequest request) {
180
150
try {
181
151
OpenAPIspec = generateOpenApiSpec(request);
182
152
183
-
// Use Jackson for OpenAPI model serialization (required by Swagger library) with enhanced HTTP/2 performance metrics tracking
0 commit comments