We have a Rest API which allows clients to GET back some binary content (e.g. Image) We are using JsonSchema to help describe the API in question so I want to built out a JsonSchema representing that content.
Looking through json-schema.org's recommendation here: [https://json-schema.org/understanding-json-schema/reference/non_json_data.html?highlight=binary][1]
The relevant JsonSchema can be represented as the following StringSchema:
{
"type": "string",
"contentEncoding": "base64",
"contentMediaType": "image/png"
}
- Searching around i found a similar question with solution but it's related to
C#and relevant implementation of the underlyingSchemaGenerator: https://bytemeta.vip/repo/JamesNK/Newtonsoft.Json.Schema/issues/284 But inspired by that I also tried looking through thecom.fasterxml.jackson.module.jsonSchema.JsonSchemaGeneratorbut also was not able to figure out how to built the relevant schema using that either. - I also tried creating a
com.fasterxml.jackson.module.jsonSchema.types.StringSchemadirectly but was also not able to add either "contentEncoding" or "contentMediaType" keywords to the generatedStringSchema.
So was wondering if anyone else happened to have any pointers on what can be done in this situation in order to generate the JsonSchema we desire?