Conversation
Describe the new behavior where `enum` on a string trait renders as a native `<select>` in the Account Experience and attaches an `options` array to the UI node for custom UIs. Related: ory-corp/cloud#10921 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
vinckr
left a comment
There was a problem hiding this comment.
needs format :)
otherwise just a few small changes
| Use the JSON Schema `enum` keyword to restrict a trait to a fixed set of | ||
| allowed values. When you declare an `enum` on a string property, the Ory | ||
| Account Experience renders the field as a dropdown (a native `<select>`) and | ||
| only accepts values from the list at registration, settings, and admin updates. |
There was a problem hiding this comment.
do you mean if going through Registration or Settings self-service flows or the update identity admin API it will only accept values from the list?
Co-authored-by: Vincent <vinckr@posteo.net>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughAdded a documentation section showing how to apply JSON Schema Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~5 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Pull request overview
This PR updates the Kratos “Customize identity schemas” documentation to explain how string enum traits are rendered as dropdowns in the Ory Account Experience, and how custom UIs can consume the resulting UI node metadata.
Changes:
- Added a new “Restrict values with
enum” section explaining dropdown rendering for string enums. - Documented that Kratos exposes allowed enum values via an
optionsarray on input attributes for UI nodes. - Added a note clarifying current support limitations (top-level string traits) and label/value behavior.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| Ory Kratos surfaces the allowed values on the UI node by attaching an `options` array to the input attributes. Custom UIs that | ||
| already know how to render a UI node can read `attributes.options` and display a `<select>`; UIs that do not look at `options` | ||
| fall back to a plain text input, so the change is backward compatible with older custom UIs. |
There was a problem hiding this comment.
The text references attributes.options, but it’s not fully clear what object attributes belongs to. Consider explicitly using the full path (for example, UI node → node.attributes.options) and briefly stating what each option entry contains, so custom UI implementers can locate and render the dropdown data reliably.
| Ory Kratos surfaces the allowed values on the UI node by attaching an `options` array to the input attributes. Custom UIs that | |
| already know how to render a UI node can read `attributes.options` and display a `<select>`; UIs that do not look at `options` | |
| fall back to a plain text input, so the change is backward compatible with older custom UIs. | |
| Ory Kratos surfaces the allowed values on the UI node by attaching an `options` array to the input's attributes object | |
| (`node.attributes.options`). Each entry in `node.attributes.options` represents one dropdown choice and contains the option | |
| value and label used to render the native `<select>`. Custom UIs that already know how to render a UI node can read | |
| `node.attributes.options` and display a `<select>`; UIs that do not look at `options` fall back to a plain text input, so the | |
| change is backward compatible with older custom UIs. |
|
|
||
| Use the JSON Schema `enum` keyword to restrict a trait to a fixed set of allowed values. When you declare an `enum` on a string | ||
| property, the Ory Account Experience renders the field as a dropdown (a native `<select>`) and only accepts values from the list | ||
| at registration, settings, and admin updates. |
There was a problem hiding this comment.
“admin updates” is ambiguous in this context (Kratos typically refers to “Admin API” / “admin endpoints” rather than a generic “admin updates”). Consider rephrasing to explicitly name the surface (e.g., “via the Admin API”) so readers know where enum validation applies.
| at registration, settings, and admin updates. | |
| at registration, in settings, and via the Admin API. |
Summary
enumon an identity schema trait renders the field as a native<select>in the Ory Account Experience.optionsarray attached toInputAttributeson the UI node so teams running a custom UI know how to render the dropdown.Related: https://github.com/ory-corp/cloud/issues/10921
Test plan
enum" section renders correctly and sits in the right place in the outline.🤖 Generated with Claude Code
Summary by CodeRabbit