public class ResponsesDef extends Object
Constructor and Description |
---|
ResponsesDef(ObjectNode root)
Creates a new ResponsesDef instance.
|
Modifier and Type | Method and Description |
---|---|
Optional<ContentDef> |
bodyContentDef(String op,
String path,
int statusCode,
String contentType)
Returns the specified response body content definition for the given status code for the given operation on the API resource at the given path.
|
boolean |
defined(String op,
String path,
int statusCode)
Returns true if expectations are defined when the given status code is received for the given operation on the API
resource at the given path.
|
boolean |
equals(Object object) |
ResponsesDef |
forOps(Collection<String> ops)
Returns a view of this ResponseDef that includes only the given API request operations.
|
ResponsesDef |
forOps(String... ops)
Returns a view of this ResponseDef that includes only the given API request operations.
|
ResponsesDef |
forPaths(Collection<String> paths)
Returns a view of this ResponseDef that includes only the given API request paths.
|
ResponsesDef |
forPaths(String... paths)
Returns a view of this ResponseDef that includes only the given API request paths.
|
boolean |
hasBody(String op,
String path,
int statusCode)
Returns true if a response body is expected when the given status code is received for the given operation on the API
resource at the given path.
|
int |
hashCode() |
List<HeaderDef> |
headerDefs(String op,
String path,
int statusCode)
Returns the names of headers defined for the given status code for the given operation on the API resource at the given path.
|
ObjectNode |
opDef(String op,
String path)
Returns the response definitions for the given path operation.
|
List<String> |
ops(String path)
Returns the operations on the given request path for which responses are defined.
|
ObjectNode |
pathDef(String path)
Returns the response definitions for the given path.
|
List<String> |
paths()
Returns the request paths for which responses are defined.
|
static ResponsesDef |
read(Reader reader)
Reads a JSON representation of response definitions from the given input stream.
|
String |
toString() |
static void |
write(ResponsesDef responses,
Writer writer)
Writes a JSON representation of response definitions to the given output stream.
|
public ResponsesDef(ObjectNode root)
public ResponsesDef forPaths(Collection<String> paths)
paths
is null or empty, include all paths.public ResponsesDef forPaths(String... paths)
paths
is null or empty, include all paths.public ResponsesDef forOps(Collection<String> ops)
ops
is null or empty, include all ops.public ResponsesDef forOps(String... ops)
public List<String> ops(String path)
public ObjectNode pathDef(String path)
public ObjectNode opDef(String op, String path)
public boolean defined(String op, String path, int statusCode)
public boolean hasBody(String op, String path, int statusCode)
public Optional<ContentDef> bodyContentDef(String op, String path, int statusCode, String contentType)
public List<HeaderDef> headerDefs(String op, String path, int statusCode)
public static void write(ResponsesDef responses, Writer writer)
public static ResponsesDef read(Reader reader)
Copyright © 2024 The Cornutum Project. All rights reserved.