Annotation Interface ApiDocResponse


Adds an explicit response entry to generated API documentation.

Handler return types are inferred automatically. Use this annotation for additional status codes, error responses, or response descriptions that cannot be derived from the method signature.

See Also:
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    int
    HTTP status code.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Optional response content type.
    Response description.
    Optional reusable response reference.
    Optional response body type.
  • Element Details

    • status

      int status
      HTTP status code.
    • description

      String description
      Response description.
      Default:
      ""
    • ref

      String ref
      Optional reusable response reference.

      A bare value such as error is resolved to #/components/responses/error. A value starting with #/ is used as-is. When set, description(), type(), and contentType() are ignored because OpenAPI Reference Objects cannot have response-object siblings in OpenAPI 3.0.

      Default:
      ""
    • type

      Class<?> type
      Optional response body type. Void.class means no explicit type was provided.
      Default:
      java.lang.Void.class
    • contentType

      String contentType
      Optional response content type.
      Default:
      ""