Top Description Methods
org.eclipse.microprofile.openapi.models

public Interface Reference<T extends Reference<T>>

Known Direct Subinterfaces
org.eclipse.microprofile.openapi.models.callbacks.Callback, org.eclipse.microprofile.openapi.models.examples.Example, org.eclipse.microprofile.openapi.models.headers.Header, org.eclipse.microprofile.openapi.models.links.Link, org.eclipse.microprofile.openapi.models.media.Schema, org.eclipse.microprofile.openapi.models.parameters.Parameter, org.eclipse.microprofile.openapi.models.parameters.RequestBody, org.eclipse.microprofile.openapi.models.responses.APIResponse, org.eclipse.microprofile.openapi.models.security.SecurityScheme, org.eclipse.microprofile.openapi.models.PathItem

Base interface for OpenAPI model objects that can make reference to other objects.

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

a reference to a T object in the components in this OpenAPI document
getRef
()

Returns the reference property from this Reference instance.

public default T

Returns:

the current instance
ref
(String
a reference to a T object in the components in this OpenAPI document
ref
)

Sets this Reference's reference property to the given string.

public void
setRef(String
a reference to a T object in the components section of this OpenAPI document or a JSON pointer to another document.
ref
)

Sets this Reference's reference property to the given string.

Method Detail

getRefback to summary
public String getRef()

Returns the reference property from this Reference instance.

Returns:String

a reference to a T object in the components in this OpenAPI document

refback to summary
public default T ref(String ref)

Sets this Reference's reference property to the given string.

Parameters
ref:String

a reference to a T object in the components in this OpenAPI document

Returns:T

the current instance

setRefback to summary
public 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 may be used alongside description and summary if they exist on the object, but is mutually exclusive with all other properties. If properties other than description and summary are defined in addition to the reference property then the result is undefined.

Parameters
ref:String

a reference to a T object in the components section of this OpenAPI document or a JSON pointer to another document.