Siren4J v2.1.0 Release Notes

Release Date: 2017-03-05 // over 4 years ago
  • ๐Ÿš€ This release adds the ability to have 'urlParams' and 'headers' defined on an action. They use the same Siren4JActionField as the 'fields' do. But they are grouped as urlParams or headers to give clear functional separation as to what they are for.

    These are particularly useful for GET type actions. Allowing the server to provide the client with enough meta for the client to properly form a request complete with urlParams and headers.

    Example:

    @Siren4JAction( name = "addReview", title = "Add a Review", method = Method.POST, href = "/courseReviews/course/{courseid}", type = "application/json",condition = @Siren4JCondition(name = "somefield", logic=Is.TRUE), fields = { @Siren4JActionField(name = "userid", type = "text", required = true ), @Siren4JActionField(name = "body", type = "text", required = true, maxLength = 250) } ,urlParams = { @Siren4JActionField(name = "filter-by", type = "text", required = true ) })
    

    ๐Ÿ“‡ Also added to an action is a metadata to allow custom data on an action as an associative array.

    metaData = { @Siren4JMetaData(key = "actionExtraStuff1", value = "hello"), @Siren4JMetaData(key = "actionExtraStuff2", value = "more stuff") }
    

Previous changes from v2.0.0

  • A getter type method can now be directly tagged as a Siren4JProperty without the need of having an actual property exist. This is particularly useful for calculated property values.

    Example:

    @Siren4JProperty
    public void getUniqueName() {
       // Do something to calculate name  
       return uniqueName
    }
    

    Will end up with a property named "uniqueName" in the "properties" or the Siren response JSON output.

    You can also override the name of the outputted property by specifying it in the annotation
    @Siren4JProperty('differentPropertyName')


    The types for the following properties in the Field object have changed

    • max , min , and maxLength were changed from int to Integer and the default value is now null
    • step is now a String instead of int , to accommodate the "any" possible value. This is a possible breaking change as consumers will need to deal with the conversion from string to the appropriate integer value. The default value is null.

    ๐Ÿ›  Fixes:

    • ๐Ÿ‘ ReflectingConverter does not support getters that aren't backed by a field #11
    • Unset values no longer suppressed with Jackson 2.7.0 #27