Ich versuche Validate JSON-Schema-Komponente in Mule-Flow zu verwenden, und ich bekomme com.fasterxml.jackson.core.JsonParseException für das JSON, das übergeben wird. Unten ist das JSON-Schema, JSON-Beispiel und Code des Mule-Flusses. Kannst du mir bitte zeigen, wo ich Fehler mache?Mule JSON-Schema-Validierung
Json Schema:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Product",
"description": "A product from Acme's catalog",
"type": "object",
"properties": {
"id": {
"description": "The unique identifier for a product",
"type": "integer"
},
"name": {
"description": "Name of the product",
"type": "string"
},
"price": {
"type": "number",
"minimum": 0,
"exclusiveMinimum": true
}
},
"required": ["id", "name", "price"]
}
Json gebene Methode POST:
[
{
"id": 2,
"name": "An ice sculpture",
"price": 12.50,
},
{
"id": 3,
"name": "A blue mouse",
"price": 25.50,
}
]
Fehler:
Root Exception stack trace:
com.fasterxml.jackson.core.JsonParseException: Unexpected character ('}' (code 125)): was expecting double-quote to start field name
at [Source: [email protected]; line: 6, column: 5]
at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1419)
at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:508)
Mule Fluss:
<http:listener-config name="HTTP_Listener_Configuration" host="0.0.0.0" port="8081" doc:name="HTTP Listener Configuration"/>
<flow name="jsonschemavalidationFlow">
<http:listener config-ref="HTTP_Listener_Configuration" path="/" allowedMethods="POST" doc:name="HTTP"/>
<json:validate-schema schemaLocation="jsonschema.json" doc:name="Validate JSON Schema"/>
<logger message="#[payload]" level="INFO" doc:name="Logger"/>
</flow>
Muleflow fein : –
user6284034