Generates a JSON schema that matches a core_schema.ChainSchema. When generating a schema for validation, we return the validation JSON schema for the first step in the chain. For serialization, we return the serialization JSON schema for the last step in the chain. Args:
(self, schema: core_schema.ChainSchema)
| 1406 | return openapi_discriminator |
| 1407 | |
| 1408 | def chain_schema(self, schema: core_schema.ChainSchema) -> JsonSchemaValue: |
| 1409 | """Generates a JSON schema that matches a core_schema.ChainSchema. |
| 1410 | |
| 1411 | When generating a schema for validation, we return the validation JSON schema for the first step in the chain. |
| 1412 | For serialization, we return the serialization JSON schema for the last step in the chain. |
| 1413 | |
| 1414 | Args: |
| 1415 | schema: The core schema. |
| 1416 | |
| 1417 | Returns: |
| 1418 | The generated JSON schema. |
| 1419 | """ |
| 1420 | step_index = 0 if self.mode == 'validation' else -1 # use first step for validation, last for serialization |
| 1421 | return self.generate_inner(schema['steps'][step_index]) |
| 1422 | |
| 1423 | def lax_or_strict_schema(self, schema: core_schema.LaxOrStrictSchema) -> JsonSchemaValue: |
| 1424 | """Generates a JSON schema that matches a schema that allows values matching either the lax schema or the |