diff --git a/core/src/main/java/com/predic8/membrane/core/openapi/serviceproxy/APIProxy.java b/core/src/main/java/com/predic8/membrane/core/openapi/serviceproxy/APIProxy.java index 7e4cd12218..2626b66e13 100644 --- a/core/src/main/java/com/predic8/membrane/core/openapi/serviceproxy/APIProxy.java +++ b/core/src/main/java/com/predic8/membrane/core/openapi/serviceproxy/APIProxy.java @@ -44,41 +44,52 @@ import static com.predic8.membrane.core.util.text.StringUtil.maskNonPrintableCharacters; /** - * @description
API proxy with several routing options.
- *Multiple APIs on the same port are discriminated by host, path, or a test
- * expression. Incoming requests are probed from the top API to the bottom. The first API that
- * matches the request will process it.
When openapi children are present, Membrane auto-wires a publisher at
- * /api-docs and an OpenAPI rewriter; see tutorials/getting-started/80-OpenAPI.yaml
- * and tutorials/getting-started/90-OpenAPI-Validation.yaml.
The main API configuration. Extends serviceProxy with REST and OpenAPI
+ * support and expression-based routing.
Several APIs can share one port and are told apart by host, path, or a test
+ * expression. Incoming requests are probed from the first API to the last; the first one that matches
+ * handles the request.
When openapi children are present, Membrane deploys the described API: it publishes
+ * the specifications at /api-docs and routes to the target from the OpenAPI
+ * servers field. See tutorials/getting-started/80-OpenAPI.yaml and
+ * tutorials/getting-started/90-OpenAPI-Validation.yaml.
+ *
+ * # Basic path routing
* api:
* port: 2000
* path:
- * uri: /orders/{id}
+ * uri: /products
* target:
- * url: https://api.predic8.de/shop/orders/{pathParam.id}
+ * url: https://api.predic8.de
+ *
* ---
+ * # URI template routing
* api:
* port: 2000
* path:
- * uri: /orders/
+ * uri: /orders/{id}
* target:
- * url: https://api.predic8.de
+ * url: https://api.predic8.de/shop/orders/{pathParam.id}
+ *
* ---
+ * # Custom routing with expression
* api:
* port: 2000
* test: header.SOAPAction == 'https://predic8.de/city-service/get'
* target:
- * url: https://api.predic8.de
+ * url: https://api.predic8.de/city-service
+ *
* ---
+ * # OpenAPI support
* api:
* port: 2000
* openapi:
* - location: openapi/fruitshop-api.yaml
+ * validateRequests: true
+ * validateResponses: true
*
*/
@MCElement(name = "api", topLevel = true, component = false)
@@ -113,7 +124,8 @@ public List/api-docs and, when configured, requests and responses are validated against it.
*/
@MCChildElement(order = 25)
public void setOpenapi(Listapis.json catalog; otherwise an id is derived from the API's key.
+ * @example order-api
+ */
@MCAttribute
public void setId(String id) {
this.id = id;
}
+ /**
+ * @description Human-readable description of the API.
+ */
@MCChildElement
public void setDescription(ApiDescription description) {
this.description = description;
}
+ /**
+ * @description Expression language used to evaluate the test attribute.
+ * @default SpEL
+ */
@MCAttribute
@Override
public void setLanguage(Language language) {
@@ -313,8 +342,8 @@ public String getContent() {
}
/**
- * XML Configuration e.g. declaration of XML namespaces for XPath expressions, ...
- * @param xmlConfig
+ * @description XML configuration for the API, such as namespace declarations used by XPath
+ * expressions.
*/
@MCChildElement(allowForeign = true,order = 10)
public void setXmlConfig(XmlConfig xmlConfig) {