Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor identity traits schema to identity schema #531

Closed
aeneasr opened this issue Jun 25, 2020 · 0 comments
Closed

Refactor identity traits schema to identity schema #531

aeneasr opened this issue Jun 25, 2020 · 0 comments
Assignees
Labels
breaking change Changes behavior in a breaking manner. feat New feature or request.

Comments

@aeneasr
Copy link
Member

aeneasr commented Jun 25, 2020

Is your feature request related to a problem? Please describe.

We currently have an identity traits schema. However, as requests for more fields (e.g. keeping track of subscription status) that are not under the user's control appear, it probably makes sense to change this.

Describe the solution you'd like

Rename "Identity Traits Schema" to "Identity Schema" and change config keys as well as JSON Schema nesting.

Describe alternatives you've considered

Multiple schemas.

@aeneasr aeneasr added feat New feature or request. breaking change Changes behavior in a breaking manner. labels Jun 25, 2020
@aeneasr aeneasr added this to the v0.4.0-alpha.1 milestone Jun 25, 2020
@aeneasr aeneasr self-assigned this Jun 25, 2020
@aeneasr aeneasr modified the milestones: v0.4.0-alpha.1, v0.5.0-alpha.1 Jul 3, 2020
aeneasr added a commit that referenced this issue Jul 7, 2020
Closes #531

BREAKING CHANGE: This patch renames the Identity Traits JSON Schema to Identity JSON Schema.

The identity payload has changed from

```
 {
-  "traits_schema_url": "...",
-  "traits_schema_id": "...",
+  "schema_url": "...",
+  "schema_id": "...",
 }
```

Additionally, it is now expected that your Identity JSON Schema includes a "traits" key at the
root level.

**Before (example)**

```
{
  "$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": {
    "email": {
      "type": "string",
      "format": "email",
      "title": "E-Mail",
      "minLength": 3,
      "ory.sh/kratos": {
        "credentials": {
          "password": {
            "identifier": true
          }
        },
        "verification": {
          "via": "email"
        },
        "recovery": {
          "via": "email"
        }
      }
    }
  },
  "required": [
    "email"
  ],
  "additionalProperties": false
}
```

**After (example)**

```
{
  "$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,
          "ory.sh/kratos": {
            "credentials": {
              "password": {
                "identifier": true
              }
            },
            "verification": {
              "via": "email"
            },
            "recovery": {
              "via": "email"
            }
          }
        }
      },
      "required": [
        "email"
      ],
      "additionalProperties": false
    }
  }
}
```

You also need to remove the `traits` key from your ORY Kratos config like this:

```
 identity:
-   traits:
-     default_schema_url: http://test.kratos.ory.sh/default-identity.schema.json
-     schemas:
-       - id: other
-         url: http://test.kratos.ory.sh/other-identity.schema.json
+   default_schema_url: http://test.kratos.ory.sh/default-identity.schema.json
+   schemas:
+     - id: other
+       url: http://test.kratos.ory.sh/other-identity.schema.json
```

Do not forget to also update environment variables for the Identity JSON Schema as well if set.
@aeneasr aeneasr closed this as completed in 949e743 Jul 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change Changes behavior in a breaking manner. feat New feature or request.
Projects
None yet
Development

No branches or pull requests

1 participant