alterschema
alterschema copied to clipboard
bug: ` media` not getting converted
Note: I'm no expert in JSON schema, so if I'm wrong in these statements, correct me!
I've tested the following draft4 schema:
{
"id": "http://example.com/schema",
"$schema": "http://json-schema.org/draft-04/schema#",
"properties": {
"bar": {
"type": "string",
"media": {
"type": "application/octet-stream",
"binaryEncoding": "base64"
}
}
}
}
and I expected it to be converted to:
{
"id": "http://example.com/schema",
"$schema": "http://json-schema.org/draft-07/schema#",
"properties": {
"bar": {
"type": "string",
"contentEncoding": "base64",
"contentMediaType": "application/octet-stream"
}
}
}
However, it didn't really touch the media.
Reference: https://json-schema.org/draft-07/json-schema-release-note
Hi @luiz00martins ,
Thanks for reaching out! In Draft4, the media keyword is only applicable to the HyperSchema dialect, so your $schema keyword should truly be set to "http://json-schema.org/draft-04/hyper-schema#".
That said, AlterSchema doesn't support HyperSchema yet, so it won't upgrade it anyway 😅 Let me create an issue for it and refer this one. I'll be doing a full revamp of this project soon, aiming to even add support all the way to Draft0.