You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the enableFlexibleCasting() option allows accepting partially missing properties, but it significantly compromises safety because it applies to all properties of all classes within the target data structure.
I would like to mark specific properties in specific classes to allow partial absence. The motivation behind this suggestion is that while it is natural for an API to have missing properties, I want to standardize types in the server implementation.
Is it realistic to implement such a feature in the future?
For example, one approach could be to identify such properties by adding annotations in the Doc comment to explicitly permit their absence:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Currently, the
enableFlexibleCasting()
option allows accepting partially missing properties, but it significantly compromises safety because it applies to all properties of all classes within the target data structure.I would like to mark specific properties in specific classes to allow partial absence. The motivation behind this suggestion is that while it is natural for an API to have missing properties, I want to standardize types in the server implementation.
Is it realistic to implement such a feature in the future?
For example, one approach could be to identify such properties by adding annotations in the Doc comment to explicitly permit their absence:
However, this might not be practical as it would require changes to the Doc parser.
Another idea I came up with is adding an option to the MapperBuilder class to mark specific properties:
Beta Was this translation helpful? Give feedback.
All reactions