-
Notifications
You must be signed in to change notification settings - Fork 11
feat(input_schema): Add enumSuggestedValues property to input schema #569
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for the enumSuggestedValues property to input schemas, providing an alternative to enum that allows custom values while providing UI suggestions.
Key changes:
- Added
enumSuggestedValuesproperty that acts as UI hints without enforcing validation - Extended
stringPropertyandsubSchemaStringPropertyto supporteditor: 'select'withenumSuggestedValues - Updated
arrayItemsSelectto support eitherenumorenumSuggestedValues(mutually exclusive) - Comprehensive test coverage for both string and array properties with various edge cases
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
test/input_schema.test.ts |
Added 13 comprehensive test cases covering enumSuggestedValues usage with string and array properties, validation of mutual exclusivity with enum, and editor requirements |
packages/json_schemas/schemas/input.schema.json |
Added select editor support to stringProperty and subSchemaStringProperty with conditional enumSuggestedValues requirement; updated arrayItemsSelect to use oneOf for enum/enumSuggestedValues exclusivity; reordered editor enums consistently |
packages/input_schema/src/types.ts |
Added enumSuggestedValues property to StringFieldDefinition type |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
valekjo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Input schema is getting pimped up :)
We'll need eat and learn on the new features
Document the new `enumSuggestedValues` property in the input schema introduced by apify/apify-shared-js#569 <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Documents `enumSuggestedValues` for `select` editors (string and array) with examples, and updates tables/guidance to distinguish strict `enum` validation from suggested values. > > - **Input schema docs** (`sources/platform/actors/development/actor_definition/input_schema/specification.md`): > - **String type**: > - Add `enumSuggestedValues` option to table with description and clarify `enumTitles` applies to `enum` and `enumSuggestedValues`. > - Note that `enum` enforces strict validation. > - **Select editor (string)**: > - Add separate examples for strict `enum` vs suggested `enumSuggestedValues`, including UI screenshots. > - **Array type (multiselect)**: > - Introduce "Select editor for arrays" section. > - Add strict multiselect using `enum` and suggested multiselect using `enumSuggestedValues` examples with screenshots. > - Clarify defining options via `items` with `enum`/`enumSuggestedValues` and `enumTitles`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 6f408c8. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
Solves https://github.com/apify/apify-core/issues/24101 - adds support for
enumSuggestedValuesproperty, that can be used instead ofenumand it:I put this to
stringProperty, accepting nowselecteditor (only ifenumSuggestedValuesis specified), because it supports also other validation keywords (pattern,...) which makes totally sense to put another constraints on the custom value. (But there's no reason to allow these additional validation keywords when usingenum.)Other things works still the same
enumcan be defined only ifeditoris not defined or isselectenumSuggestedValuescan be defined only ifeditorisselect.enumorenumSuggestedValuescan (must) be defined ifeditorisselectDraft with changes to make this work in UI is ready here: https://github.com/apify/apify-core/pull/24164