Skip to content

Enhancement: Support for Direct Serialization and Deserialization of Quantity Objects #543

@k1ng-maus

Description

@k1ng-maus

Description:
Currently, the library does not support direct serialization and deserialization of Quantity objects. This limitation prevents the use of Quantity as a standalone object in endpoints, resulting in a NullPointerException. An example of the issue is shown below:

@PostMapping
public Quantity<Length> readQuantity(@RequestBody Quantity<Length> payload) {
    return payload;
}

The following exception is thrown:

java.lang.NullPointerException: Cannot invoke "com.fasterxml.jackson.databind.BeanProperty.getType()" because "property" is null 

Improvement Proposal:
I propose adding support for the direct serialization and deserialization of Quantity objects. This would allow developers to use Quantity in RESTful APIs and other contexts without wrapping it in a POJO.

Personal Experience:
I have been exploring the library and its capabilities, and I like what I have seen. However, I believe that we can improve it even more.

Implementation Offer:
If it is acceptable, I am willing to implement this feature. Please let me know if this is okay, and I will be happy to start working on it.

Thank you for considering this enhancement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions