arunsarin85 opened a new pull request, #10112:
URL: https://github.com/apache/ozone/pull/10112

   …tated API types
   
   ##Motivation to add the test
   Recon’s /api/v1 JSON is produced by Jersey + Jackson with JAXB-aware 
serialization. Many types mix @XmlElement and @JsonProperty; some JSON names do 
not match getter/bean names (e.g. opState vs getOperationalState(), PascalCase 
Volume vs volume).
   
   Most existing API tests call endpoints and use Response#getEntity() as Java 
objects, so they never validate the serialized JSON. A Jersey/Jackson upgrade 
or a misconfigured JSON provider could rename or omit JSON fields without 
failing those tests, while the Recon UI and API clients break.
   
   These tests pin the wire contract for important types and document the gap 
between “correct” Jersey serialization and plain Jackson.
   
   ## What changes were proposed in this pull request?
   
   - Added TestReconApiJsonContract under 
hadoop-ozone/recon/src/test/java/org/apache/hadoop/ozone/recon/api/.
   - Tests serialize Recon API DTOs with JacksonJaxbJsonProvider (same family 
as Jersey’s jersey-media-json-jackson) and assert stable JSON property names 
for high-traffic responses.
   - Coverage includes: PipelinesResponse / PipelineMetadata, DatanodesResponse 
/ DatanodeMetadata, ClusterStateResponse, KeyMetadata, 
UnhealthyContainerMetadata / UnhealthyContainersResponse, 
MissingContainerMetadata / MissingContainersResponse, 
RemoveDataNodesResponseWrapper, ContainerMetadata.
   - Where JAXB names differ from plain JavaBean names, tests also compare to a 
naive ObjectMapper (Java Time module only) and assert forbidden keys (e.g. 
operationalState vs opState, volume vs Volume, containerID vs ContainerID).
   
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-15096
   
   ## How was this patch tested?
   
   mvn test -pl hadoop-ozone/recon -Dtest=TestReconApiJsonContract
   <img width="1058" height="374" alt="image" 
src="https://github.com/user-attachments/assets/163d20e8-a1ea-4757-9781-2f6be9d43fa4";
 />
   
   


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to