Reputation: 359
in Mule 4 I just want to display the JSONschema using DataWeave but I get an error for reference ids or any field started with '$' in JSON schema. The mime/type is application/json. The goal is to display the schema, I'll appreciate any suggestions. Thanks!
SAMPLE SCHEMA
{
"definitions": {},
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://example.com/example.json",
"type": "object",
"title": "The Root Schema",
"properties": {
"checked": {
"$id": "/properties/checked",
"type": "boolean",
"title": "The Checked Schema",
"default": false,
"examples": [
false
]
},
"dimensions": {
"$id": "/properties/dimensions",
"type": "object",
"title": "The Dimensions Schema",
"required": [
"width",
"height"
],
"properties": {
"width": {
"$id": "/properties/dimensions/properties/width",
"type": "integer",
"title": "The Width Schema",
"default": 0,
"examples": [
5
]
},
"height": {
"$id": "/properties/dimensions/properties/height",
"type": "integer",
"title": "The Height Schema",
"default": 0,
"examples": [
10
]
}
}
},
"id": {
"$id": "/properties/id",
"type": "integer",
"title": "The Id Schema",
"default": 0,
"examples": [
1
]
}
}
}
Upvotes: 0
Views: 267
Reputation: 2014
Use blackslash \
before $, this will print your schema with $ in column names. Unfortuanely, $ as a prefix is not treated as part of string in Mule
Example
"\$id": "/properties/dimensions/properties/width"
will print
"$id": "/properties/dimensions/properties/width"
Upvotes: 1