Hello, I use a custom identity file: ```{ "$id"...
# ory-selfhosting
f
Hello, I use a custom identity file:
Copy code
{
  "$id": "<https://schemas.ory.sh/presets/kratos/quickstart/email-password/identity.schema.json>",
  "$schema": "<http://json-schema.org/draft-07/schema#>",
  "title": "Person",
  "type": "object",
  "properties": {
    "traits": {
      "type": "object",
      "properties": {
        "email": {
          "type": "string",
          "format": "email",
          "title": "E-Mail",
          "minLength": 3,
          "maxLength": 100,
          "description": "Professional e-mail address",
          "<http://ory.sh/kratos|ory.sh/kratos>": {
            "credentials": {
              "password": {
                "identifier": true
              }
            },
            "verification": {
              "via": "email"
            },
            "recovery": {
              "via": "email"
            }
          }
        },
        "contact": {
          "type": "object",
          "properties": {
            "company": {
              "type": "string",
              "format": "no-validate",
              "title": "Company",
              "description": "Company associated with the person",
              "minLength": 3
            },
            "phone": {
              "type": "string",
              "title": "Phone Number",
              "format": "tel",
              "description": "The phone number of the person"
            }
          },
          "required": [
            "company"
          ]
        },
        "name": {
          "type": "object",
          "properties": {
            "first": {
              "title": "First Name",
              "type": "string"
            },
            "last": {
              "title": "Last Name",
              "type": "string"
            }
          },
          "required": [
            "first",
            "last"
          ]
        }
      },
      "required": [
        "email"
      ]
    }
  }
}
I was expecting that the traits would contains the name and the company but:
Copy code
"identity": {
            "created_at": "2025-05-28T11:42:52.828748Z",
            "id": "82c80f30-317b-4093-8ce0-d739974ec909",
            "metadata_public": null,
            "organization_id": null,
            "recovery_addresses": [
               {
                  "created_at": "2025-05-28T11:42:52.829458Z",
                  "id": "d275c7be-86cf-49f8-b69e-d1679b4f6b62",
                  "updated_at": "2025-05-28T11:42:52.829458Z",
                  "value": "<mailto:fcdscsd@flex.ai|fcdscsd@flex.ai>",
                  "via": "email"
               }
            ],
            "schema_id": "default",
            "schema_url": "https://.../schemas/ZGVmYXVsdA",
            "state": "active",
            "state_changed_at": "2025-05-28T11:42:52.827931299Z",
            "traits": {
               "email": "<mailto:fcdscsd@flex.ai|fcdscsd@flex.ai>"
            },
            "updated_at": "2025-05-28T11:42:52.828748Z",
            "verifiable_addresses": [
               {
                  "created_at": "2025-05-28T11:42:52.829185Z",
                  "id": "a107b90f-cd99-4f4f-b50c-89b8b5222043",
                  "status": "sent",
                  "updated_at": "2025-05-28T11:42:52.829185Z",
                  "value": "<mailto:fcdscsd@flex.ai|fcdscsd@flex.ai>",
                  "verified": false,
                  "via": "email"
               }
            ]
         },
b
The "contacts" block is not marked as required, so it will not prevent user's from leaving the fields empty.
f
I filled it, and it's not in the traits. I may get it from flow part of the context but not really convinient
and if I add it as require I can not sign up. It says always missing field company
even without being into an object
I took the identification file from https://www.ory.sh/docs/kratos/manage-identities/customize-identity-schema#more-advanced-validation (fixed the coma issue) and I have an error in the self ui the property username is missing
b
The format would be "contact.company" and "contact.phone" (not as nested JSON object), I believe
f
even without nested object it doesn't work and the example from ory neither
btw, thx to try to help me
Capture d’écran 2025-05-28 à 15.25.43.png
b
Username doesn't appear in the identity schema from above. Is it using a different identity schema?
f
the one in the link that I provided:
Copy code
{
  "$id": "<https://schemas.ory.sh/presets/kratos/identity.email.schema.json>",
  "title": "Person",
  "type": "object",
  "definitions": {
    "phone": {
      "type": "string",
      "format": "tel",
      "title": "Phone Number"
    },
    "optIn": {
      "type": "boolean",
      "title": "Get security related notifications"
    }
  },
  "properties": {
    "traits": {
      "type": "object",
      "properties": {
        "username": {
          "type": "string",
          "title": "Username",
          "minLength": 6,
          "maxLength": 32,
          "<http://ory.sh/kratos|ory.sh/kratos>": {
            "credentials": {
              "password": {
                "identifier": true
              },
              "webauthn": {
                "identifier": true
              },
              "totp": {
                "account_name": true
              },
              "passkey": {
                "display_name": true
              }
            }
          }
        },
        "email": {
          "type": "string",
          "format": "email",
          "title": "E-Mail",
          "<http://ory.sh/kratos|ory.sh/kratos>": {
            "credentials": {
              "password": {
                "identifier": true
              },
              "webauthn": {
                "identifier": true
              },
              "totp": {
                "account_name": true
              },
              "code": {
                "identifier": true,
                "via": "email"
              },
              "passkey": {
                "display_name": true
              }
            },
            "recovery": {
              "via": "email"
            },
            "verification": {
              "via": "email"
            }
          },
          "maxLength": 320
        },
        "phone": {
          "$ref": "#/definitions/phone"
        },
        "optIn": {
          "$ref": "#/definitions/optIn"
        }
      },
      "required": [
        "email",
        "username"
      ],
      "additionalProperties": false,
      "dependencies": {
        "optIn": {
          "properties": {
            "phone": {
              "$ref": "#/definitions/phone"
            }
          },
          "required": [
            "phone"
          ]
        },
        "phone": {
          "properties": {
            "optIn": {
              "$ref": "#/definitions/optIn"
            }
          },
          "required": [
            "optIn"
          ]
        }
      }
    }
  }
}
in playground it works without issue
I made progress, I move to 1.2.0 (but it wasn't working too). I remove the custom web_hook and it works. I will try with only one web_hook
with one web hook:
Copy code
"traits": {
        "email": "<mailto:csdcse@flex.ai|csdcse@flex.ai>",
        "optIn": true,
        "phone": "+33660606060",
        "username": "csdvfdvsdvsdc"
      },
we have a hook that where parsed by kratos. In this case, I have the issue above, because the hook replay with only the email and it should remove all other traits for next hook.
I thought that the hook can add stuff, I didn't thought that it was removing information from the request
https://www.ory.sh/docs/guides/integrate-with-ory-cloud-through-webhooks#modify-identities For me in this case I have:
Copy code
{
  "identity": {
    "traits": {
      "another_value": "example"
    }
  }
}
instead of:
Copy code
{
  "identity": {
    "traits": {
      "email": "<mailto:joe@example.org|joe@example.org>",
      "another_value": "example"
    }
  }
}
The kratos implementation do not follow the documentations:https://www.ory.sh/docs/guides/integrate-with-ory-cloud-through-webhooks#modify-identities if the web hook api reply with:
Copy code
{
  "identity": {
    "traits": {
      "email": "...@..."
    }
  }
}
Then the traits are all replaced with the return value instead of agregating the values together
b
When updating any of the identity fields, be aware that the whole field is replaced by the value returned by the webhook. For example, if the user signed up with
Not sure I understand, but pretty sure you're running into this?
f
no you are right. I miss understood your documentation. if you do not send the full traits, the webhook can not update it