Skip to content

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

Open

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

Activity

  1. added this to the 0.4 milestone on Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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