Class MessageDescriptorToSchemaConverter

java.lang.Object
dev.enola.common.protobuf.schema.MessageDescriptorToSchemaConverter

Conversion from Protocol Buffers (model, not instances) to Google GenAI Schema (which is based on OpenAPI 3.0 schema, which in turn is very much like JSON Schema).

The Schema matches how a Proto message (instance, not model) would be serialized in ProtoJSON format.

Other than just being 💃 fun, this is (very) useful to be able to 🧑🏽‍🍼 feed 🥄 Language Models, such as Google 🔮 Gemini, 🥢 Protos instead of only 📜 text, for 🧰 tools (whether through MCP 🔱 or not), or to configure their expected structured output.

  • Constructor Details

  • Method Details

    • convert

      public com.google.genai.types.Schema convert(com.google.protobuf.Message message)
    • convert

      public com.google.genai.types.Schema convert(com.google.protobuf.Descriptors.Descriptor descriptor)