Interface Reference<T extends Reference<T>>

All Known Subinterfaces:
APIResponse, Callback, Example, Header, Link, Parameter, PathItem, RequestBody, Schema, SecurityScheme

public interface Reference<T extends Reference<T>>
Base interface for OpenAPI model objects that can make reference to other objects.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the reference property from this Reference instance.
    default T
    ref(String ref)
    Sets this Reference's reference property to the given string.
    void
    Sets this Reference's reference property to the given string.
  • Method Details

    • getRef

      String getRef()
      Returns the reference property from this Reference instance.
      Returns:
      a reference to a T object in the components in this OpenAPI document
    • setRef

      void setRef(String ref)
      Sets this Reference's reference property to the given string.

      Normally a full reference string is a JSON pointer RFC6901 which indicates an object definition in the components section of the current OpenAPI document. For example the schema of a request body may be #/components/schemas/Payload or the definition of a parameter could be #/components/parameters/Routing.HostName.

      If you provide a short name then the name will automatically be expanded to the appropriate full reference string. A short name is a string which is not a JSON pointer in that it does not contain a "/".

      The appropriate full reference is determined by the context. For a parameter the short name will be prefixed by "#/components/parameters/" to create "#/components/parameters/ShortName".

      parameter.setRef("ShortName"); // #/components/parameters/ShortName
      For a response the prefix is "#/components/responses/":
      response.setRef("NotFound"); // #/components/responses/NotFound

      This property provides a reference to an object defined elsewhere. This property and all other properties are mutually exclusive. If other properties are defined in addition to the reference property then the result is undefined.

      Parameters:
      ref - a reference to a T object in the components section of this OpenAPI document or a JSON pointer to another document.
    • ref

      default T ref(String ref)
      Sets this Reference's reference property to the given string.
      Parameters:
      ref - a reference to a T object in the components in this OpenAPI document
      Returns:
      the current instance