Open
Description
For the example, I've got products with product references.
Here's the code to set "select-product" relation.
private static ProductDto withSelectProductAffordance(ProductDto productDto) {
SelectProductRequest request = SelectProductRequest.builder()
.reference(productDto.getReference())
.build();
Link selectProductLink = linkTo(methodOn(SelectProductResource.class)
.selectProduct(request))
.withRel(ProductCatalogRelations.SELECT_PRODUCT);
Link affordance = selectProductLink
.andAffordance(afford(methodOn(SelectProductResource.class)
.selectProduct(request)));
return productDto.add(affordance);
}
Here's the current result of the collection of products:
{
"_embedded": {
"products": [
{
"reference": "product-001",
"_links": {
"select-product": {
"href": "http://localhost:8080/api/select-product"
}
},
"_templates": {
"default": { ... },
"selectProduct": {
"method": "post",
"properties": [
{
"name": "reference",
"required": true,
"type": "text"
}
],
"target": "http://localhost:8080/api/select-product"
}
}
},
{ ... }
]
}
}
I would expect to have product reference already set in selectProduct
template like below:
"properties": [
{
"name": "reference",
"required": true,
"type": "text",
"value": "product-001"
}
]
It seems that value does not exist in AffordanceModel#PropertyMetadata
but is a valid in the spec: https://rwcbook.github.io/hal-forms/#_code_value_code
I would also expect the template name to be the same as the link rel.
Metadata
Metadata
Assignees
Labels
No labels