dfoxg/kratos-admin-ui

Boolean traits shows as fields, any input leads to mismatch of types sting!=boolean

Closed this issue · 3 comments

Describe the bug
Boolean traits shows as fields, any input leads to mismatch of types sting!=boolean, which lead to problem to update the traits.

To Reproduce
Steps to reproduce the behavior:

  1. create a JSON schema
{
  "$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",
  "definitions": {
    "tosUrl": {
      "type": "string",
      "const": "http://example.com/terms"
    }
  },
  "properties": {
    "traits": {
      "type": "object",
      "properties": {
        "email": {
          "type": "string",
          "format": "email",
          "title": "E-Mail",
          "minLength": 3,
          "ory.sh/kratos": {
            "credentials": {
              "password": {
                "identifier": true
              }
            },
            "verification": {
              "via": "email"
            },
            "recovery": {
              "via": "email"
            }
          }
        },
        "username": {
          "title": "Username",
          "type": "string",
          "readOnly": true
        },
        "name": {
          "type": "object",
          "properties": {
            "first": {
              "title": "First Name",
              "type": "string"
            },
            "last": {
              "title": "Last Name",
              "type": "string"
            }
          }
        },
        "tos": {
          "title": "Accept Terms of Service",
          "type": "boolean",
          "description": "I accept the terms of service",
          "writeOnly": true,
          "tosUrl": {
            "$ref": "#/definitions/tosUrl"
           }
        },
        "newsletter": {
          "type": "boolean",
          "title": "Newsletter subscription"
        }
      },
      "required": [
        "email",
        "username",
        "tos"
      ],
      "additionalProperties": false
    }
  }
}
  1. register and verify user
  2. open kratos-admin-ui
  3. open created user on edit
  4. update any boolean traits - Accept Terms of Service or Newsletter subscription
  5. See error
    {"code":400,"status":"Bad Request","reason":"I[#/traits/newsletter] S[#/properties/traits/properties/newsletter/type] expected boolean, but got string","message":"The request was malformed or contained invalid parameters"}

Expected behavior
kratos-admin-ui shows checkbox as a checkbox, update of the checkbox passes without errors

Screenshots
image

Desktop (please complete the following information):

  • OS: windows 10
  • Browser chrome
  • Version 123.0.6312.123

Additional context

kratos version 1.1.0

kratos-admin-ui used inside docker-compose.yaml as this

  kratos-admin-ui:
    image: ghcr.io/dfoxg/kratos-admin-ui
    ports:
      - 8080:8080
    environment:
      - KRATOS_ADMIN_URL=http://kratos:4434
      - KRATOS_PUBLIC_URL=http://kratos:4433
    depends_on:
      - kratos
      - auth-db
    networks:
      - intranet

Thanks for reporting that, i'll have a look at it :)

@dfoxg Thank you
Now it's work fine

image