|
|
@ -44,7 +44,12 @@ evaluate_forwardref = eval_type_lenient |
|
|
class GenerateJsonSchema(_GenerateJsonSchema): |
|
|
class GenerateJsonSchema(_GenerateJsonSchema): |
|
|
def bytes_schema(self, schema: CoreSchema) -> JsonSchemaValue: |
|
|
def bytes_schema(self, schema: CoreSchema) -> JsonSchemaValue: |
|
|
json_schema = {"type": "string", "contentMediaType": "application/octet-stream"} |
|
|
json_schema = {"type": "string", "contentMediaType": "application/octet-stream"} |
|
|
if self._config.ser_json_bytes == "base64": |
|
|
bytes_mode = ( |
|
|
|
|
|
self._config.ser_json_bytes |
|
|
|
|
|
if self.mode == "serialization" |
|
|
|
|
|
else self._config.val_json_bytes |
|
|
|
|
|
) |
|
|
|
|
|
if bytes_mode == "base64": |
|
|
json_schema["contentEncoding"] = "base64" |
|
|
json_schema["contentEncoding"] = "base64" |
|
|
self.update_with_validations(json_schema, schema, self.ValidationsMapping.bytes) |
|
|
self.update_with_validations(json_schema, schema, self.ValidationsMapping.bytes) |
|
|
return json_schema |
|
|
return json_schema |
|
|
|