Skip to content

Commit bdb89c6

Browse files
committed
fix: drop the data wrapper on a form schema raw content
1 parent a45d2f9 commit bdb89c6

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/main/kotlin/com/ctrlhub/core/datacapture/response/FormSchema.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,7 @@ data class FormSchema @JsonCreator constructor(
4242
"attributes" to attributes
4343
)
4444

45-
val envelope = mapOf("data" to dataMap)
46-
47-
return mapper.writeValueAsString(envelope)
45+
return mapper.writeValueAsString(dataMap)
4846
}
4947
}
5048

src/test/kotlin/com/ctrlhub/core/datacapture/FormSchemaRawSchemaTest.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ class FormSchemaRawSchemaTest {
3636
// Parse the generated JSON and assert structure
3737
val node = mapper.readTree(raw)
3838

39-
assertEquals(id, node["data"]["id"].asText())
40-
assertEquals("form-schemas", node["data"]["type"].asText())
39+
assertEquals(id, node["id"].asText())
40+
assertEquals("form-schemas", node["type"].asText())
4141

42-
val attributes = node["data"]["attributes"]
42+
val attributes = node["attributes"]
4343
assertEquals(version, attributes["version"].asText())
4444
assertTrue(attributes["model"]["properties"].has("field-1"))
4545
}

0 commit comments

Comments
 (0)