我正在尝试向我的 REST API 发送 POST 请求。所有字段,如名称、描述等......根据需要工作并使用@NotNull 等验证器正确验证。但是,当涉及到嵌入对象时,没有任何字段正在验证。当没有任何位置字段被传递并且只是将它们默认为 0 时,它不会显示错误
我已经尝试使用之前帖子中提到的 @Valid 注释,但是这似乎仍然不起作用。
实体
@Entity
@Table(name = "loos")
public class Loo implements Serializable {
private static final long serialVersionUID = 9098776609946109227L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private long id;
@Column(name = "uuid", columnDefinition = "BINARY(16)")
private UUID uuid;
@NotNull(message = "Name cannot be null")
@Column(name = "name")
private String name;
@NotNull(message = "Description cannot be null")
@Type(type="text")
@Column(name = "description")
private String description;
@NotNull(message = "Location cannot be null")
@Embedded
@AttributeOverrides({ @AttributeOverride(name …
Run Code Online (Sandbox Code Playgroud) 我想在 R markdown 文档中创建动态部分。为此,我使用带有asis
输出类型的 R 块。这些块包含由reactable
包创建的表。
当我在 for 循环中创建表格时,我无法打印表格。我知道通常必须将绘图或类似内容包装print()
在循环中,但这对我的情况没有影响。
我怎样才能打印表格?
---
title: "Test"
author: "Test"
date: "29 11 2021"
output: html_document
---
```{r include=FALSE}
library(reactable)
```
```{r results='asis', echo=FALSE}
cat("\n\n## My header 1 \n\n")
reactable(data.frame(test = rnorm(3))) ## This works
```
```{r results='asis', echo=FALSE}
for (i in 1:3) {
cat("\n\n## My header ", i+1, "\n\n")
print(reactable(data.frame(test = rnorm(3)))) ## shows nothing
}
```
Run Code Online (Sandbox Code Playgroud)