Replies: 1 comment 1 reply
-
Hi @eedijs 👋 Are you asking about nested attributes in terms of testing or in general? In general you can use a custom type in hibernate to serialize/deserialize to/from a string/fragment class. Here is an example of a Person entity with an address fragment: For testing with the test helpers you can provide an instance of the fragment class as seen here (in Kotlin): given()
.header("User", USER1)
.contentType("application/vnd.api+json")
.body(
datum(
resource(
type("deliveryRules"),
id("1"),
attributes(
attr("frequency", "quarter"),
attr("schedulingRules", SchedulingRules(true)), // sets attribute with new instance of SchedulingRules fragment class
)
)
).toJSON()
)
.`when`()
.patch("/deliveryRules/1")
.then()
.assertThat()
.statusCode(HttpStatus.SC_NO_CONTENT) |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
Is there a plan to add the possibility to have nested attributes? At the moment this
Attributes
class can only be created from an array ofAttribute
objects, but what if there was another constructor that accepted anotherAttributes
object or similar, that also contains an array ofAttribute
objects?Example usage:
Beta Was this translation helpful? Give feedback.
All reactions