我有两个模块的spring-boot项目但是当我试图运行测试时,Idea没有生成./idea/modules文件夹我得到了下一个错误
'无法启动进程,工作目录/home/../my_project_name/.idea/modules'不存在
重新导入或重建整个项目无法解决问题.
我在springboot项目上使用swagger.端点出现问题,返回带有MonetaryAmount列表的实体ie(List<MonetaryAmount> rates)
Swagger-ui显示这些端点的错误数据:
{
"rates": [
null
]
}
Run Code Online (Sandbox Code Playgroud)
但是我希望将每个MonetaryAmount值看作Double和String对.像这样的Smth:
{
"rates": [
{"currency":"EUR", "rate": 12.23}
]
}
Run Code Online (Sandbox Code Playgroud)
我试图使用directModelSubstitute,但似乎它不适用于List.
这是我的模型:
public class CurrencyRatesResponse implements Serializable {
private List<MonetaryAmount> rates;
public CurrencyRatesResponse() {
}
public CurrencyRatesResponse(List<MonetaryAmount> rates) {
this.rates = rates;
}
public List<MonetaryAmount> getRates() {
return rates;
}
public void setRates(List<MonetaryAmount> rates) {
this.rates = rates;
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的端点的一个例子
@RequestMapping(path = "/public/rates", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public CurrencyRatesResponse getRates() {...}
Run Code Online (Sandbox Code Playgroud)
生成的招摇JSON:
"/public/rates":{
"get":{
"tags":[
"rate-endpoint"
], …Run Code Online (Sandbox Code Playgroud) 假设,我有一些预定义模式的索引,例如
"mappings": {
"transactions": {
"dynamic": "strict",
"properties": {
"someDate": {
"type": "date"
},
"nestedOjects": {
"type": "nested",
"properties": {
"someField": {
"type": "text"
}
}
}Run Code Online (Sandbox Code Playgroud)
现在我需要通过将新字段添加到嵌套对象中来更新此映射。即我想要实现这样的目标:
"mappings": {
"transactions": {
"dynamic": "strict",
"properties": {
"someDate": {
"type": "date"
},
"nestedOjects": {
"type": "nested",
"properties": {
"someField": {
"type": "text"
},
"newField": {
"type": "text"
}
}
}Run Code Online (Sandbox Code Playgroud)