Skip to content

Commit

Permalink
fix: make username nullable in user-schema (#5656)
Browse files Browse the repository at this point in the history
I noticed I was getting warnings logged in my local instance when
visiting the users page (`/admin/users`)

```json
{
    "schema": "#/components/schemas/publicSignupTokensSchema",
    "errors": [
        {
            "instancePath": "/tokens/0/users/0/username",
            "schemaPath": "#/components/schemas/userSchema/properties/username/type",
            "keyword": "type",
            "params": {
                "type": "string"
            },
            "message": "must be string"
        }
    ]
}
```

It was complaining because one of my users doesn't have a username, so
the value returned from the API was:

```json
{
    "users": [
        {
            "id": 2,
            "name": "2mas",
            "username": null
        }
    ]
}
```

This adjustment fixes that oversight by allowing `null` values for the
username.
  • Loading branch information
thomasheartman committed Dec 16, 2023
1 parent 24c2a70 commit ab2281d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/lib/openapi/spec/user-schema.ts
Expand Up @@ -36,6 +36,7 @@ export const userSchema = {
description: 'A unique username for the user',
type: 'string',
example: 'hunter',
nullable: true,
},
imageUrl: {
description: `URL used for the userprofile image`,
Expand Down

0 comments on commit ab2281d

Please sign in to comment.