public class ResponseObjectBuilder extends Object
Describes a single response from an API Operation, including design-time, static links
to operations
based on the response.
Constructor and Description |
---|
ResponseObjectBuilder() |
Modifier and Type | Method and Description |
---|---|
ResponseObject |
build() |
static ResponseObjectBuilder |
mergeResponses(ResponseObject primary,
ResponseObject secondary)
Creates a new build by merging two existing response objects
|
static ResponseObjectBuilder |
responseObject()
Creates a builder for a
ResponseObject |
ResponseObjectBuilder |
withContent(Map<String,MediaTypeObject> content) |
ResponseObjectBuilder |
withDescription(String description) |
ResponseObjectBuilder |
withHeaders(Map<String,HeaderObject> headers) |
ResponseObjectBuilder |
withLinks(Map<String,LinkObject> links) |
public ResponseObjectBuilder withDescription(String description)
description
- REQUIRED. A short description of the response.
CommonMark syntax MAY be used for rich text representation.public ResponseObjectBuilder withHeaders(Map<String,HeaderObject> headers)
headers
- Maps a header name to its definition. RFC7230
states header names are case insensitive. If a response header is defined with the name
"Content-Type"
, it SHALL be ignored.public ResponseObjectBuilder withContent(Map<String,MediaTypeObject> content)
content
- A map containing descriptions of potential response payloads. The key is a media type or
media type range and the value
describes it. For responses that match multiple keys, only the most specific key is applicable.
e.g. text/plain overrides text/*public ResponseObjectBuilder withLinks(Map<String,LinkObject> links)
links
- A map of operations links that can be followed from the response.public ResponseObject build()
public static ResponseObjectBuilder responseObject()
ResponseObject
public static ResponseObjectBuilder mergeResponses(ResponseObject primary, ResponseObject secondary)
primary
- A responses object to use. This is the dominant response who's values will
be preferred when values cannot be merged (such as ResponseObject.description
secondary
- The other responses objectCopyright © 2017–2021. All rights reserved.