-
Notifications
You must be signed in to change notification settings - Fork 0
warnings
nimamoosavi edited this page Aug 6, 2021
·
3 revisions
This annotation is used AOP (Aspect Oriented Programing ) for creating warning and add to your Response
this CrossCutting Implement in Framework Project that You Can Add To your Project And fill warning to your Response
warning data fill in BaseDTO Response in notifies Object
Log annotation has one Attribute that you can set return Warning
DEPRECATED {
@Override
public String key() {
return this.name();
}
},
VERSION {
@Override
public String key() {
return this.name();
}
}
Warning Properties Example
DEPRECATED.message=this version of api deprecated
VERSION.message=version 1.0.2
package app.ladderproject.integration.controller;
import app.ladderproject.crud.controller.BaseController;
import app.ladderproject.framework.anotations.Warnings;
import app.ladderproject.framework.domain.dto.BaseDTO;
import app.ladderproject.framework.enums.warn.Warning;
import app.ladderproject.integration.domain.entity.Affair;
import app.ladderproject.integration.domain.view.request.AffairReqVM;
import app.ladderproject.integration.domain.view.response.AffairResVM;
import io.swagger.annotations.Api;
import io.swagger.annotations.SwaggerDefinition;
import io.swagger.annotations.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping(value = "/rest/integration/v1/affair")
@Api(value = "Integration", protocols = "HTTP")
@SwaggerDefinition(tags = {@Tag(name = "Integration", description = "سرویس مدیریت اطلاعات")})
@RequiredArgsConstructor
public class AffairController extends BaseController<Affair, AffairReqVM, AffairResVM, Long> {
@Override
@Warnings(warnings = {Warning.DEPRECATED,Warning.VERSION})
public ResponseEntity<BaseDTO<AffairResVM>> findByID(Long id) {
return super.findByID(id);
}
}
{
"code": "0",
"message": "عملیات با موفقیت انجام شد",
"status": "SUCCESS",
"data": {
"id": 101,
"name": "22",
"code": "122"
},
"notifies": [
{
"status": "WARN",
"notify": "this version of api deprecated"
},
{
"status": "WARN",
"notify": "version 1.0.2"
}
]
}