Skip to content

[Chat] Enhancing the JSON schema with validation constraints #113

@wachterjohannes

Description

@wachterjohannes

While the schema structure is good, consider adding validation constraints to improve data quality:

             new JsonSchemaResponseFormat([
                 'type' => 'object',
                 'properties' => [
                     'name' => [
                         'type' => 'string',
                         'description' => 'The name of the user',
+                        'minLength' => 1,
+                        'maxLength' => 100
                     ],
                     'age' => [
                         'type' => 'integer',
                         'description' => 'The age of the user',
+                        'minimum' => 0,
+                        'maximum' => 150
                     ],
                 ],
+                'required' => ['name', 'age'],
+                'additionalProperties' => false
             ]),

Originally generated by #112 (review)

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions