Annotation Type AdditionalProperties


  • @Retention(RUNTIME)
    @Target(TYPE)
    public @interface AdditionalProperties
    Annotation to define JSON Schema additionalProperties, which is useful when working with key/value JSON data structures.

    For example, the following JSON Schema defines a map from string (key) to string (value),

    
     {
       "type": "object",
       "additionalProperties": {
         "type": "string"
       }
     }
     
    Note that keys are always strings in JSON, so the schema does not define that fact.

    The annotation in this example would be used as follows,

     @AdditionalProperties(String.class)
     private static class MyMap extends HashMap<String, String> {}
     
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      Class<?> value
      The type to produce the additional-properties schema from.
    • Element Detail

      • value

        Class<?> value
        The type to produce the additional-properties schema from.
        Default:
        java.lang.Void.class