Package com.google.genai.gaos.utils
Class OpenapiJacksonModule
java.lang.Object
com.fasterxml.jackson.databind.Module
com.google.genai.gaos.utils.OpenapiJacksonModule
- All Implemented Interfaces:
com.fasterxml.jackson.core.Versioned
public class OpenapiJacksonModule
extends com.fasterxml.jackson.databind.Module
A composite Jackson
Module that registers all SDK-required Jackson customizations.
Register this with a custom ObjectMapper to enable full serialization support
for SDK types. Bundles JavaTimeModule, Jdk8Module,
and SDK strict deserializers, and applies the same feature flags used by
JSON.getMapper():
- Disables
WRITE_DATES_AS_TIMESTAMPS(ISO-8601 date strings) - Disables
FAIL_ON_UNKNOWN_PROPERTIES - Disables
FAIL_ON_EMPTY_BEANS - Enables
FAIL_ON_NULL_FOR_PRIMITIVES - Restricts field visibility to annotated fields only
ObjectMapper myMapper = new ObjectMapper()
.registerModule(new OpenapiJacksonModule());
String json = myMapper.writeValueAsString(response);
Alternatively, use JSON.getMapper() to access the pre-configured SDK mapper directly.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.fasterxml.jackson.databind.Module
com.fasterxml.jackson.databind.Module.SetupContext -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidsetupModule(com.fasterxml.jackson.databind.Module.SetupContext context) com.fasterxml.jackson.core.Versionversion()Methods inherited from class com.fasterxml.jackson.databind.Module
getDependencies, getTypeId
-
Constructor Details
-
OpenapiJacksonModule
public OpenapiJacksonModule()
-
-
Method Details
-
getModuleName
- Specified by:
getModuleNamein classcom.fasterxml.jackson.databind.Module
-
version
public com.fasterxml.jackson.core.Version version()- Specified by:
versionin interfacecom.fasterxml.jackson.core.Versioned- Specified by:
versionin classcom.fasterxml.jackson.databind.Module
-
setupModule
public void setupModule(com.fasterxml.jackson.databind.Module.SetupContext context) - Specified by:
setupModulein classcom.fasterxml.jackson.databind.Module
-