Skip to content

Commit

Permalink
Resolve schema failures with embedded images (#32)
Browse files Browse the repository at this point in the history
Embedded image is also a string, so would result in both oneOf checks
passing and thus triggering a failure.

Conditionally check the format of image string if it is set to be a data
url.
  • Loading branch information
b-wils authored May 22, 2024
1 parent 7e36b9c commit 6b009b3
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions schema/assets/image.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@
"p": {
"title": "File Name",
"description": "Name of the image file or a data url",
"oneOf": [
{"type": "string"},
{"$ref": "#/$defs/values/data-url"}
]
"type": "string"
},
"u": {
"title": "File Path",
Expand All @@ -39,6 +36,20 @@
"$ref": "#/$defs/values/int-boolean"
}
},
"allOf": [
{
"if": {
"properties": {
"e": 1
}
},
"then": {
"properties": {
"p": {"$ref": "#/$defs/values/data-url"}
}
}
}
],
"required": ["w", "h", "p"]
}
]
Expand Down

0 comments on commit 6b009b3

Please sign in to comment.