Angular - Spring support - request validation
已回答
Hello,
I'm starting with an angular+spring project. I've been struggling with an error which occurs quite often - - a difference between a structure sent from front-end and a request class in a back-end. Namely:
in front end:
http.post<any>('http://localhost:8080/login', {username: username, password: password}
in the back end:
public class LoginRequest {
@Getter @Setter private String login;
@Getter @Setter private String password;
}
....aand here it is, login=null. Is there a way to validate the typescript code against java model? This is really irritating for a developer which is used to static/compiler validation. I have a project which contains two modules - one for angular and one for spring(boot).
Greetings,
J.
请先登录再写评论。
I don't think IntelliJ IDEA has such a feature.
note - I wouldn't mind if I needed to add some annotations or use a proxy pattern or whatever
Direct validation would be hard indeed, but one could define schema and somehow assign it to both typescript and java code, like here:
https://www.jetbrains.com/help/idea/json-schema.html