Generates a JSON schema that matches a float value. Args: schema: The core schema. Returns: The generated JSON schema.
(self, schema: core_schema.FloatSchema)
| 672 | return json_schema |
| 673 | |
| 674 | def float_schema(self, schema: core_schema.FloatSchema) -> JsonSchemaValue: |
| 675 | """Generates a JSON schema that matches a float value. |
| 676 | |
| 677 | Args: |
| 678 | schema: The core schema. |
| 679 | |
| 680 | Returns: |
| 681 | The generated JSON schema. |
| 682 | """ |
| 683 | json_schema: dict[str, Any] = {'type': 'number'} |
| 684 | self.update_with_validations(json_schema, schema, self.ValidationsMapping.numeric) |
| 685 | json_schema = {k: v for k, v in json_schema.items() if v not in {math.inf, -math.inf}} |
| 686 | return json_schema |
| 687 | |
| 688 | def decimal_schema(self, schema: core_schema.DecimalSchema) -> JsonSchemaValue: |
| 689 | """Generates a JSON schema that matches a decimal value. |