Annotation Interface OpenApi.RequestBody

Enclosing class:
OpenApi

@Target(METHOD) @Retention(CLASS) @Documented public static @interface OpenApi.RequestBody
OpenAPI Request Body Object metadata.

Use only on a method with an effective declarative HTTP request body input. The input can be a direct @Http.Entity parameter, an @Http.RequestParams record with an @Http.Entity component, or one or more @Http.FormParam parameters or request-param record components.

For entity inputs, content is inferred from the entity type and the method's consumed media types unless content() overrides it. For form inputs, generated content is always application/x-www-form-urlencoded; the schema is inferred from the form field names and types and cannot be overridden with OpenApi.Content.schema().

Requiredness is inferred from the effective input: Optional entity parameters, entity components, and form fields are optional, defaulted form fields are optional, and other entity or form inputs are required. Use required() to make an optional input required. A required input cannot be documented as optional because the runtime binding still requires it.

  • Element Details

    • value

      String value
      Request body description.
      Returns:
      description
      Default:
      ""
    • required

      Requiredness override.
      Returns:
      requiredness
      Default:
      UNSPECIFIED
    • content

      OpenApi.Content[] content
      Request body content entries.
      Returns:
      content
      Default:
      {}