-
Notifications
You must be signed in to change notification settings - Fork 28
feat: added user-friendly storybook component #1759
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
base: develop
Are you sure you want to change the base?
Conversation
Plus please make it 🟢 and fix title |
I have read the Code of Conduct and I hereby accept the Terms |
I have read the CLA Document and I hereby accept the CLA |
options?: { | ||
items: ValueLabelPairInterface[]; | ||
}; | ||
} |
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.
What is the reason for creating all those interfaces?
As I believe for userPlayground we can use code like this
if (item.type === 'index') {
const migrated = migrateIndexTypeEntity(item as IndexEntity);
result = SingleSelectEntity.safeParse(migrated);
} else if (item.type === 'interval') {
const migrated = migrateIntervalTypeEntity(item as IntervalEntity);
result = TextEntity.safeParse(migrated);
} else {
result = AnyOfEntity.safeParse(item);
}
using existing zod types and elements
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.
We can rely on Zod inference alone, but defining explicit TypeScript interfaces and using satisfies helps enforce stricter type alignment. This has been especially helpful in Storybook, where strict validation ensures type errors surface clearly during development.
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.
Just wondering why those interface introduction is necessary.
Issue number: ADDON-78948
PR Type
What kind of change does this PR introduce?
Summary
Changes
Introduced a dedicated playground for entity validation within Storybook. This update allows users to dynamically modify the input arguments of each entity and instantly validate the configuration. The main goal is to ensure that only allowed key-value pairs are used, helping to catch unknown or unsupported properties early in the development process.
User experience
With this playground in place, users can interactively experiment with entity inputs directly in Storybook. By tweaking the arguments, they can immediately see if any invalid keys are present, streamlining the debugging process and improving schema adherence. This makes the validation workflow more intuitive and efficient, reducing the chances of misconfigured entities and also reduce the efforts to build and check the entities in UI.
Checklist
If an item doesn't apply to your changes, leave it unchecked.
Review
Tests
See the testing doc.
Demo/meeting:
Reviewers are encouraged to request meetings or demos if any part of the change is unclear