Generates a JSON schema that matches a bytes value. Args: schema: The core schema. Returns: The generated JSON schema.
(self, schema: core_schema.BytesSchema)
| 777 | return json_schema |
| 778 | |
| 779 | def bytes_schema(self, schema: core_schema.BytesSchema) -> JsonSchemaValue: |
| 780 | """Generates a JSON schema that matches a bytes value. |
| 781 | |
| 782 | Args: |
| 783 | schema: The core schema. |
| 784 | |
| 785 | Returns: |
| 786 | The generated JSON schema. |
| 787 | """ |
| 788 | json_schema = {'type': 'string', 'format': 'base64url' if self._config.ser_json_bytes == 'base64' else 'binary'} |
| 789 | self.update_with_validations(json_schema, schema, self.ValidationsMapping.bytes) |
| 790 | return json_schema |
| 791 | |
| 792 | def date_schema(self, schema: core_schema.DateSchema) -> JsonSchemaValue: |
| 793 | """Generates a JSON schema that matches a date value. |