Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Protobuf WellKnownTypes when generating schema with ProtobufMapper #349

Open
efgpinto opened this issue Jan 6, 2023 · 1 comment
Labels

Comments

@efgpinto
Copy link

efgpinto commented Jan 6, 2023

Assuming we have a Java POJO such as:

public record Test(String value, Instant ts) {
}

And then we use:

private val protobufMapper = ProtobufMapper.builder
  .addModule(new JavaTimeModule)
  .build()
    
val jacksonProtoSchema = protobufMapper.generateSchemaFor(classOf[Test])

The ts field will be automatically mapped as double. I'm looking at a way to have it converted to a Message type of google.protobuf.Timestamp. I've tried using a new module with custom ser/deserializers but the issue there is it drops google.protobuf. qualifiers for the type, using the simple name of the raw class instead.

I've looked at the code as well and cannot find anything that would support this so I'm not sure if I'm missing something or if this would be new functionality.

@cowtowncoder
Copy link
Member

Quick note: I am almost certain it would be new functionality; I am not familiar with WellKnownTypes metadata (from protoc?). But it sounds doable.

One practical blocker might be that the underlying protoc parser this module uses should probably replaced first (see #121). I suspect this might be necessary to find relevant metadata, unless this is actually something specified by Protobuf spec.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants