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

ProtoSchemaConverter renders invalid schema for oneof in unwrap mode #3039

Open
aka-peter opened this issue Oct 31, 2024 · 0 comments
Open

Comments

@aka-peter
Copy link

Describe the bug, including details regarding any error messages, version, and platform.

When unwrap is enabled all fields of the TestProto3.OneOfTestMessage will be required.

message TestProto3.OneOfTestMessage {
  required int32 first = 1;
  required int32 second = 2;
}

This will never work but tests are missing for unwrap of TestProto3.OneOfTestMessage

The required repetition is added here:

Repetition repetition = unwrapProtoWrappers ? Repetition.REQUIRED : getRepetition(descriptor);

This could be caught early by adding withValidation(true) here:

If validation is disabled it will fail when trying to read one of the non-existing fields in the oneof.

Is there really a need for setting all primitive fields in unwrap to required?

Component(s)

No response

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

No branches or pull requests

1 participant