Is it possible to create an identity schema with a...
# talk-kratos
c
Is it possible to create an identity schema with a custom "format" field for a trait property? We want to try and map the format field to frontend validation rules (e.g. form pre-submit validation).
s
you can specify regular expressions https://json-schema.org/understanding-json-schema/reference/string.html#index-12 or enums, depends on what you need
c
I don't see the enums? What I'm really looking for is to give each trait (field) in the identity schema a custom type that can be passed down through the registration flow api. We want a type hint beyond the json-schema types (string, object, etc) to indicate how we should display that field. For instance if it is a date, we want to show a datepicker, or if we want to tie custom functionality to a certain type of string.
s
we don't support anything outside of the json schema spec but the format should be passed down, so a date string can be displayed as a date picker you will have to use the JSON primitives anyway, and then there is always a way to describe it as a json schema
c
It doesn't seem like the Format is passed down during the registration flow though 😞
@steep-lamp-91158 Do you know if the Format should be passed down as part of the registration flow API response? We aren't seeing it show up in the response to createBrowserRegistraationFlow. We see the
pattern
field on a trait with type
string
, but not the
format
.
Can you confirm if the node attribute "type" (
ui.nodes[].attributes['type']
) is this format field? It seems there is some kind of mapping from the json schema format values to this type field but it is unclear.