Conversation
Co-authored-by: benny779 <75434503+benny779@users.noreply.github.com>
Co-authored-by: benny779 <75434503+benny779@users.noreply.github.com>
…plication Co-authored-by: benny779 <75434503+benny779@users.noreply.github.com>
Co-authored-by: benny779 <75434503+benny779@users.noreply.github.com>
|
@copilot, Before I start the review please add test cases for this new feature. Even you can't run the tests since you have no access to the internet, I'll run these tests manually. |
Co-authored-by: benny779 <75434503+benny779@users.noreply.github.com>
Added comprehensive test cases in commit b46d5d8. The tests cover: Updated existing tests to use the new signature with New XML validation tests (13 new tests):
All tests verify that XML responses are returned for XML requests and JSON for JSON requests. |
|
@copilot, your implementation breaks the api of the FhirValidator.java class. |
You're right - I broke the API by changing method signatures. Here's a better solution: Use method overloading to maintain backward compatibility:
This way:
Should I implement this approach? |
|
@copilot, you can implement it. don't forget to update the tests. |
Co-authored-by: benny779 <75434503+benny779@users.noreply.github.com>
Implemented in commit 0a56e8b. The API is now backward compatible: Changes:
Tests updated:
|
Swagger UI currently exposes only
application/fhir+json. This addsapplication/fhir+xmlsupport to both validation endpoints, enabling users to test XML resources directly.Changes
Controller (
FhirValidationController.java)application/fhir+xml,application/fhir+xml;charset=UTF-8)/validateand/validateBundleto accept and produce XML in addition to JSONValidator (
FhirValidator.java)validateBundleXml()for XML bundle validation usingManager.FhirFormat.XMLvalidateBytes(byte[], List<String>, FhirValidatorConfiguration)andvalidateBundle(byte[], FhirValidatorConfiguration)are preserved and default to JSON formatcontentTypeparameter for XML/JSON supportParser Support (
FhirUtil.java)XmlParser)Tests (
FhirValidatorApplicationTests.java)contentTypeparametervalidateBytes: valid/invalid patients, observations, case-insensitive content typevalidateBundle: valid/invalid bundles, multiple entries, type validation, empty bundlesAPI Impact
Swagger UI now displays both content types in the "Media type" dropdown for testing.
Backward Compatibility
✅ No breaking changes - original method signatures are preserved
✅ External code using the original API continues to work unchanged
✅ Original methods default to JSON format (maintaining existing behavior)
✅ Controller uses new overloaded methods for XML support
Testing
✅ All existing tests updated for new method signatures
✅ 13 new XML-specific test cases added
✅ 2 backward compatibility tests added
✅ Compilation passes successfully
✅ CodeQL security scan passed with zero issues
Fixes Add support for FHIR XML in Swagger UI #32
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.