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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
     
    void
    setupModule(com.fasterxml.jackson.databind.Module.SetupContext context)
     
    com.fasterxml.jackson.core.Version
     

    Methods inherited from class com.fasterxml.jackson.databind.Module

    getDependencies, getTypeId

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • OpenapiJacksonModule

      public OpenapiJacksonModule()
  • Method Details

    • getModuleName

      public String getModuleName()
      Specified by:
      getModuleName in class com.fasterxml.jackson.databind.Module
    • version

      public com.fasterxml.jackson.core.Version version()
      Specified by:
      version in interface com.fasterxml.jackson.core.Versioned
      Specified by:
      version in class com.fasterxml.jackson.databind.Module
    • setupModule

      public void setupModule(com.fasterxml.jackson.databind.Module.SetupContext context)
      Specified by:
      setupModule in class com.fasterxml.jackson.databind.Module