Skip to content

Conversation

@mfori
Copy link
Member

@mfori mfori commented Oct 17, 2025

This PR:

  • Adds support for specifying default, prefill and example for sub-properties in input schema.

    {
     "object": {
      "default": { "key1": "fromParent" },
      "properties": {
       "key1": {
         "default": "fromChild"
       }
      }
     }
    }
    

    Default would be: { "object": { "key1": "fromParent" } }

  • Adds support for specifying validation keywords under items property, like:

    {
     title: 'Field title',
     description: 'My test field',
     type: 'array',
     editor: 'schemaBased',
      items: {
       type: 'string',
       pattern: '^\\d+$',
       minLength: 2,
       maxLength: 4
     }
    }
    

    This is handled automatically by Ajv.

@mfori mfori self-assigned this Oct 17, 2025
@mfori mfori added adhoc Ad-hoc unplanned task added during the sprint. t-console Issues with this label are in the ownership of the console team. labels Oct 17, 2025
@github-actions github-actions bot added this to the 125th sprint - Console team milestone Oct 17, 2025
@github-actions github-actions bot added the tested Temporary label used only programatically for some analytics. label Oct 17, 2025
@mfori mfori requested review from Copilot, gippy and valekjo October 17, 2025 11:01
@mfori mfori marked this pull request as ready for review October 17, 2025 11:01
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds support for default, prefill, and example on nested (sub-)properties in the input schema and extends array item validation to honor per-item constraints (pattern, min/max length, numeric bounds, etc.).

  • Introduces prefill/example/default keywords across sub-schema definitions (string, enum, number, integer, boolean, object, resource, arrays) with nullable-aware default typing.
  • Enhances array items schema to allow validation keywords for primitive item types (string/integer/number/boolean) and updates tests to cover string item validation.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
test/utilities.client.test.ts Adds test ensuring array item constraints (pattern, min/max length, type) are validated.
test/input_schema.test.ts Extends test schema to include nested defaults/prefills/examples for object and array sub-properties.
packages/json_schemas/schemas/input.schema.json Adds prefill/example/default handling with nullable logic; replaces additionalProperties with unevaluatedProperties; extends array items schema to support validation keywords for primitive types.

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Member

@valekjo valekjo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. The schema is growing more than Apify :D

"type": "object",
"properties": {
"type": { "enum": ["string", "integer", "boolean", "object", "array"] }
"type": { "enum": ["string", "integer", "number", "boolean", "object", "array"] }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: This is unrelated fix to allow floats, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I forgot to add it here when adding float support

@mfori mfori merged commit 115f5bb into master Oct 22, 2025
9 checks passed
@mfori mfori deleted the feat/sub-properties-defaults branch October 22, 2025 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-console Issues with this label are in the ownership of the console team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants