Class OpenAPIDefinition
- java.lang.Object
-
- org.mockserver.model.ObjectWithReflectiveEqualsHashCodeToString
-
- org.mockserver.model.ObjectWithJsonToString
-
- org.mockserver.model.Not
-
- org.mockserver.model.RequestDefinition
-
- org.mockserver.model.OpenAPIDefinition
-
public class OpenAPIDefinition extends RequestDefinition
- Author:
- jamesdbloom
-
-
Constructor Summary
Constructors Constructor Description OpenAPIDefinition()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)StringgetContextPathPrefix()StringgetOperationId()StringgetSpecUrlOrPayload()inthashCode()static OpenAPIDefinitionopenAPI()static OpenAPIDefinitionopenAPI(String specUrlOrPayload)Specify the OpenAPI to match against by URL or payload and string as follows:static OpenAPIDefinitionopenAPI(String specUrlOrPayload, String operationId)Specify the OpenAPI and operationId to match against by URL or payload and string as follows:OpenAPIDefinitionshallowClone()OpenAPIDefinitionupdate(OpenAPIDefinition replaceRequest)OpenAPIDefinitionwithContextPathPrefix(String contextPathPrefix)OpenAPIDefinitionwithOperationId(String operationId)Specify operationId from the OpenAPI to match against i.e.OpenAPIDefinitionwithSpecUrlOrPayload(String specUrlOrPayload)Specify the OpenAPI to match against by URL or payload as follows:-
Methods inherited from class org.mockserver.model.RequestDefinition
cloneWithLogCorrelationId, getLogCorrelationId, withLogCorrelationId
-
Methods inherited from class org.mockserver.model.ObjectWithJsonToString
toString
-
Methods inherited from class org.mockserver.model.ObjectWithReflectiveEqualsHashCodeToString
fieldsExcludedFromEqualsAndHashCode
-
-
-
-
Method Detail
-
openAPI
public static OpenAPIDefinition openAPI()
-
openAPI
public static OpenAPIDefinition openAPI(String specUrlOrPayload)
Specify the OpenAPI to match against by URL or payload and string as follows:// Create from a publicly hosted HTTP location (json or yaml) openAPI("https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore-expanded.yaml")
// Create from a file on the local filesystem (json or yaml) openAPI("file://Users/myuser/git/mockserver/mockserver-core/src/test/resources/org/mockserver/openapi/openapi_petstore_example.json");
// Create from a classpath resource in the /api package (json or yaml) openAPI("org/mockserver/openapi/openapi_petstore_example.json");
// Create from an OpenAPI payload (json or yaml) openAPI("{\"openapi\": \"3.0.0\", \"info\": { ...")
- Parameters:
specUrlOrPayload- the OpenAPI to match against by URL or payload- Returns:
- the OpenAPIMatcher
-
openAPI
public static OpenAPIDefinition openAPI(String specUrlOrPayload, String operationId)
Specify the OpenAPI and operationId to match against by URL or payload and string as follows:// Create from a publicly hosted HTTP location (json or yaml) openAPI("https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore-expanded.yaml", "showPetById")
// Create from a file on the local filesystem (json or yaml) openAPI("file://Users/myuser/git/mockserver/mockserver-core/src/test/resources/org/mockserver/openapi/openapi_petstore_example.json", "showPetById");
// Create from a classpath resource in the /api package (json or yaml) openAPI("org/mockserver/openapi/openapi_petstore_example.json", "showPetById");
// Create from an OpenAPI payload (json or yaml) openAPI("{\"openapi\": \"3.0.0\", \"info\": { ...", "showPetById")
- Parameters:
specUrlOrPayload- the OpenAPI to match against by URL or payloadoperationId- operationId from the OpenAPI to match against i.e. "showPetById"- Returns:
- the OpenAPIMatcher
-
getSpecUrlOrPayload
public String getSpecUrlOrPayload()
-
withSpecUrlOrPayload
public OpenAPIDefinition withSpecUrlOrPayload(String specUrlOrPayload)
Specify the OpenAPI to match against by URL or payload as follows:// Create from a publicly hosted HTTP location (json or yaml) withSpecUrlOrPayload("https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/petstore-expanded.yaml")
// Create from a file on the local filesystem (json or yaml) withSpecUrlOrPayload("file://Users/myuser/git/mockserver/mockserver-core/src/test/resources/org/mockserver/openapi/openapi_petstore_example.json");
// Create from a classpath resource in the /api package (json or yaml) withSpecUrlOrPayload("org/mockserver/openapi/openapi_petstore_example.json");
// Create from an OpenAPI payload (json or yaml) withSpecUrlOrPayload("{\"openapi\": \"3.0.0\", \"info\": { ...")
- Parameters:
specUrlOrPayload- the OpenAPI to match against by URL or payload- Returns:
- the OpenAPIMatcher
-
getOperationId
public String getOperationId()
-
withOperationId
public OpenAPIDefinition withOperationId(String operationId)
Specify operationId from the OpenAPI to match against i.e. "showPetById"- Parameters:
operationId- operationId from the OpenAPI to match against i.e. "showPetById"- Returns:
- the OpenAPIMatcher
-
getContextPathPrefix
public String getContextPathPrefix()
-
withContextPathPrefix
public OpenAPIDefinition withContextPathPrefix(String contextPathPrefix)
-
shallowClone
public OpenAPIDefinition shallowClone()
- Specified by:
shallowClonein classRequestDefinition
-
update
public OpenAPIDefinition update(OpenAPIDefinition replaceRequest)
-
equals
public boolean equals(Object o)
- Overrides:
equalsin classRequestDefinition
-
hashCode
public int hashCode()
- Overrides:
hashCodein classRequestDefinition
-
-