Identity schema and validation of booleans #97
-
How do you validate a "accepted_tos" boolean like the one mentioned in https://www.ory.sh/docs/kratos/concepts/identity-schema I'm trying to add it to the "Username & Password" cloud default schema, ending up with something like: {
"$id": "https://schemas.ory.sh/presets/kratos/identity.username.schema.json",
"title": "Person",
"type": "object",
"properties": {
"traits": {
"type": "object",
"properties": {
"username": {
"type": "string",
"title": "Username",
"maxLength": 100,
"ory.sh/kratos": {
"credentials": {
"password": {
"identifier": true
},
"webauthn": {
"identifier": true
},
"totp": {
"account_name": true
}
}
}
},
"accepted_tos": {
"type": "boolean",
"title": "Accept terms and conditions",
"enum": [
true
]
}
},
"required": [
"username",
"accepted_tos"
],
"additionalProperties": false
}
}
} But that leaves various UI issues:
How would someone go about this with the default UI shipped with Ory Cloud? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Sorry, in my initial reply I missed the UI issues! The JSON Schema does not need an "enum".
Thank you, created an issue for it: ory/kratos-selfservice-ui-node#182
The const workaround should help a bit
I see, did you try adding it as HTML to the JSON Schema? We don't support that at the moment for security reasons, but we could think about adding Markdown support to the fields: ory/kratos#2522
That is currently a manual process. One option is to:
Not yet but we have it on the backlog! |
Beta Was this translation helpful? Give feedback.
-
Markdown support for titles would be much appreciated! I ran into the same use-case (Terms of Service). |
Beta Was this translation helpful? Give feedback.
Sorry, in my initial reply I missed the UI issues!
The JSON Schema does not need an "enum".