How do you configure `metadata_public` for an iden...
# ory-network
f
How do you configure
metadata_public
for an identity schema? I thought I had done it correctly, but the Managed UI is showing an extra field now (with no label) for my metadata property. The docs say the metadata isn’t validated, so do you just not include it in the identity schema?
Here is my schema:
Copy code
{
  "$id": "<https://exammple.com/ory/identity.schema.json>",
  "title": "Example User",
  "type": "object",
  "properties": {
    "traits": {
      "type": "object",
      "properties": {
        "email": {
          "type": "string",
          "format": "email",
          "title": "Email",
          "<http://ory.sh/kratos|ory.sh/kratos>": {
            "credentials": {
              "password": {
                "identifier": true
              },
              "webauthn": {
                "identifier": true
              },
              "totp": {
                "account_name": true
              }
            },
            "recovery": {
              "via": "email"
            },
            "verification": {
              "via": "email"
            }
          },
          "maxLength": 320
        },
        "name": {
          "type": "object",
          "properties": {
            "first": {
              "type": "string",
              "title": "First name",
              "maxLength": 256
            },
            "last": {
              "type": "string",
              "title": "Last name",
              "maxLength": 256
            }
          }
        }
      },
      "required": [
        "email"
      ],
      "additionalProperties": false
    },
    "metadata_public": {
      "type": "object",
      "properties": {
        "bonfireUserId": {
          "type": "string"
        }
      },
      "additionalProperties": false
    }
  }
}
m
like so for example
Copy code
"metadata_public": {
      "type": "object",
      "properties": {
        "lang": {
          "type": "string",
          "title": "Preferred Language"
        }
      }
    }
Copy code
"metadata_public": {
      "type": "object",
      "properties": {
        "bonfireUserId": {
          "type": "string",
          "title": "bonfireUserId"
        }
      }
    }
s
yes, there is (currently) no point in including it in the schema as it is basically ignored
f
Thanks @steep-lamp-91158. I guess I’ll just remove it from the schema. You may want to update the docs to be more clear about not including it. https://github.com/ory/kratos/issues/2513 sort of covers the fields showing in the UI, but talks more about validation. I don’t mind that the values aren’t validated at this time. But it is nice to have the metadata in the schema so all team members are aware of what the metadata should look like.
s
Ideally metadata would behave the same as traits, but not show up in the UI
💯 1
f
Yes. Long-term that would be ideal.