-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEAT]: not have to had @JsonProperty all over the place? #228
Comments
I was using serializeObject and deserializeObject on this tyep and the title is lost :( :( @JsonObject() |
I found an option 'allow' that fixed this. I am very surprised it was not the default. I would have an @JsonProperty(exclude=true) instead like jackson as 90% of time no one wants to type all these @JsonProperty all over the place. closing. |
ohhh, odd, I did need it after all @JsonObject() so it serializes fine and then on the server side if I do not have @JsonProperty, it fails to load the outlineId into the json :(. or is this a bug? I was hoping I could miss many and it seems I can miss some but others are critical and must have. |
I have a log before and after serializing but also in the middle I have and finding where things are going wrong is a huge pain. in java, it would fail fast pointing to exact annotation missing or a 'can't serialize this as it is not a POJO or something'. any way to fail fast here? I am spending way too much time trying to figure out why it is not invoking my afterSerialize: stageEnumToString. is there some kind of logging in place for debugging? |
getting closer. first enum works and second one does not. second one does NOT call afterSerialize on the way out. When server reads it in, it also does not call beforeDeserialize and instead fails on cryptic error
I don't have any name properties but it fails with [1] chokepoint stack TypeError: Cannot read properties of undefined (reading 'name') |
Description
perhaps there is already a solution for this?
Coming from java land, jackson simply will do any plain old class. I realize typescript is different and needs decorators and things dissapears. We have 15 apis and 20 methods = 300 request, 300 responses * on average 10 fields lets say -> 6000 locations of needing @JsonProperty. I do not want to add those all. I do not mind adding @JsonObject 600 times probably more as requests and responses use similar objects under the covers. (I guess 6000 maybe a bit high then too). Anyways, I only want to use @JsonProperty when I need to like for Date or enum and special cases. string fields should not need them and if I want to exclude a propery, I would use @JsonExclude or something. our apis do not have a single exclusion(that is pretty rare that this is desired since our api is implemented by controller server-side and on the client side, we have a client implemetning the same exact api. Our client/server apis are 100% using the same code.
Proposed solution
use @JsonObject and assume all fields are included except ones with @JsonExclude much like jackson in java does. is this possible?
The text was updated successfully, but these errors were encountered: