From 992651060d7b16f641b304b98ce2d0847de97cb4 Mon Sep 17 00:00:00 2001 From: oluexpert99 Date: Sat, 22 Aug 2026 14:44:59 +0100 Subject: [PATCH] FINERACT-2776: Add entitySubType to GetDataTablesResponse schema POST /datatables accepts an entitySubType and the platform stores it in x_registered_table.entity_subtype. Both GET routes return it: DatatableData carries the field, and DatatableReadServiceImpl selects entity_subtype and passes it to DatatableData.create on the list path and the single-table path alike. The class both routes name as their @ApiResponse schema does not declare it. PostDataTablesRequest does; GetDataTablesResponse does not. So the published document describes a datatable as having only applicationTableName, registeredTableName and columnHeaderData, and a caller can set a property that the documented response does not contain. Hand-written clients are unaffected, since the JSON has the field. Generated ones cannot read it at all. entitySubType scopes a datatable to a client legal form, so a client that renders custom fields on a customer needs it to tell whether a given table belongs on a person or on an entity. DatatableIntegrationTest already sets entitySubType on eleven datatable creations and never asserts it comes back, because the generated model has no getter for it. validateCreateAndEditDatatable now asserts the sub type it created the table with. fineract-client is generated from this spec, so that assertion does not compile before this change and passes after it. No runtime behaviour changes; the response was already correct. Signed-off-by: oluexpert99 --- .../dataqueries/api/DatatablesApiResourceSwagger.java | 2 ++ .../integrationtests/datatable/DatatableIntegrationTest.java | 1 + 2 files changed, 3 insertions(+) diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/DatatablesApiResourceSwagger.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/DatatablesApiResourceSwagger.java index b8b5b0c350b..37a99155b95 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/DatatablesApiResourceSwagger.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/api/DatatablesApiResourceSwagger.java @@ -45,6 +45,8 @@ private GetDataTablesResponse() { public String applicationTableName; @Schema(example = "extra_client_details") public String registeredTableName; + @Schema(example = "Person", description = "The entity sub type the datatable is registered against, when the application table supports one (for example Person or Entity on m_client). Null when the registration is not scoped to a sub type.") + public String entitySubType; public List columnHeaderData; } diff --git a/integration-tests/src/test/java/org/apache/fineract/integrationtests/datatable/DatatableIntegrationTest.java b/integration-tests/src/test/java/org/apache/fineract/integrationtests/datatable/DatatableIntegrationTest.java index c2fc66e62ce..8141da85834 100644 --- a/integration-tests/src/test/java/org/apache/fineract/integrationtests/datatable/DatatableIntegrationTest.java +++ b/integration-tests/src/test/java/org/apache/fineract/integrationtests/datatable/DatatableIntegrationTest.java @@ -702,6 +702,7 @@ public void validateCreateAndEditDatatable() { assertEquals(datatableName, datatableUpdateResponse.getResourceIdentifier()); GetDataTablesResponse dataTable = datatableHelper.getDataTableDetails(datatableName); + assertEquals(CLIENT_PERSON_SUBTYPE_NAME, dataTable.getEntitySubType()); List columnHeaders = dataTable.getColumnHeaderData(); assertEquals(5, columnHeaders.size()); ResultsetColumnHeaderData stringColumn = columnHeaders.get(1);