MaxonT opened a new pull request, #41760: URL: https://github.com/apache/beam/pull/41760
I read through closed PR 34213, which was left with spotless and test requests, and this PR adds parsedData to HL7v2Message, keeping the 8-argument constructor and adding a 9-argument one. This adds a `parsedData` field to `HL7v2Message`, so HL7v2IO users who do not use schematized parsing can read the parsed segments the Healthcare API returns. It was requested in #20452. Changes: - `HL7v2Message` keeps the `ParsedData` from `Message.getParsedData()`, exposes it through `getParsedData()`, writes it back in `toModel()`, and includes it in `equals` and `hashCode`. - The existing 8-argument constructor is unchanged and delegates with `parsedData = null`. A new 9-argument constructor takes the parsed data. - `HL7v2MessageCoder` encodes `parsedData` as a nullable JSON string after the existing fields, and decodes it with `GsonFactory`. The existing fields keep their order. - `CHANGES.md` entry under the unreleased 2.79.0 I/Os section. - New `HL7v2MessageCoderTest`: coder round trip with and without parsedData, `fromModel`/`toModel` keep parsedData, parsedData takes part in `equals`, and the 8-argument constructor leaves it null. Related work: the earlier PR #34213 for the same field was closed unmerged after review asked for spotless fixes and tests. This PR keeps the constructor compatible and adds the coder change and the tests that were missing. Compatibility: - Public API: additions only. No signature, type or default changed. - Coder wire format: one trailing nullable string is added to `HL7v2MessageCoder`. A pipeline that carries `HL7v2Message` elements encoded by the previous coder across an update would not decode them. Reviewers should decide whether that needs a note or a version guard. Testing, run on this head with local Gradle on JDK 21: - `./gradlew :sdks:java:io:google-cloud-platform:spotlessCheck :sdks:java:io:google-cloud-platform:checkstyleMain :sdks:java:io:google-cloud-platform:checkstyleTest`: exit 0. - `./gradlew :sdks:java:io:google-cloud-platform:test --tests "org.apache.beam.sdk.io.gcp.healthcare.HL7v2MessageCoderTest"`: 5 of 5 passed. - `HL7v2IOTest` ran in the same command: its 3 tests fail with "Your default credentials were not found", because they call the live Healthcare API and this machine has no GCP credentials. Those tests also round-trip `HL7v2Message` through the coder, so the coder change is covered only by the new test class here. Not verified on upstream CI. - The regression test uses the new constructor and getter, so it does not compile before this change. Not run: the full google-cloud-platform test suite, the integration tests (`*IT`), and upstream CI. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
