Package org.mockserver.openapi
Class OpenAPIConverter
java.lang.Object
org.mockserver.openapi.OpenAPIConverter
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuildExampleRequests(String specUrlOrPayload) Builds a concrete exampleHttpRequestfor each path operation in the spec, populating examplepath,query,header, andcookieparameter values (and a request body where the operation declares one) via the sharedOpenApiParameterExampleshelper.buildExampleRequests(String specUrlOrPayload, Map<String, Object> operationsAndResponses) buildExpectations(String specUrlOrPayload, Map<String, Object> operationsAndResponses) buildExpectations(String specUrlOrPayload, Map<String, Object> operationsAndResponses, String contextPathPrefix) static booleanisJsonContentType(String contentType) static booleanisXmlContentType(String contentType) True when the content type denotes XML —application/xml,text/xml, or any media type with a+xmlstructured-syntax suffix (e.g.
-
Constructor Details
-
OpenAPIConverter
-
-
Method Details
-
buildExpectations
-
buildExampleRequests
Builds a concrete exampleHttpRequestfor each path operation in the spec, populating examplepath,query,header, andcookieparameter values (and a request body where the operation declares one) via the sharedOpenApiParameterExampleshelper.This is additive and independent of
buildExpectations(java.lang.String, java.util.Map<java.lang.String, java.lang.Object>): that method emits anOpenAPIDefinitionmatcher (which carries no concrete parameter values), whereas this method produces realised example requests for documentation, preview, replay seeding, and client/contract-test scaffolding. Webhook operations are excluded because they are not directly callable as path requests.- Returns:
- a map of
operationIdto its exampleHttpRequest
-
buildExampleRequests
-
buildExpectations
-
isJsonContentType
-
isXmlContentType
True when the content type denotes XML —application/xml,text/xml, or any media type with a+xmlstructured-syntax suffix (e.g.application/atom+xml). Used to route a generated example throughXmlExampleSerializerso an XML response yields a real XML body rather than a JSON-shaped string.
-