1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-06-04 01:18:20 +02:00
unleash.unleash/src/lib/openapi/spec/update-user-schema.ts
Thomas Heartman 7ea4e5d5b9
chore: remove additionalProperterties: true annotation. (#4508)
Unless you set `additionalProperties` to `false`, additional properties
are always
allowed. By explicitly setting it to `true` the generated
examples contain additional properties, e.g.:

```json
{
  "tokens": [
    "aproject:development.randomstring",
    "[]:production.randomstring"
  ],
  "additionalProp1": {}
}
```

By removing the explicit annotation, we still allow additional
properties, but we don't get them in examples:

```json
{
  "tokens": [
    "aproject:development.randomstring",
    "[]:production.randomstring"
  ]
}
```
2023-08-16 11:17:05 +02:00

40 lines
1.2 KiB
TypeScript

import { FromSchema } from 'json-schema-to-ts';
export const updateUserSchema = {
$id: '#/components/schemas/updateUserSchema',
type: 'object',
description: 'All fields that can be directly changed for the user',
properties: {
email: {
description:
"The user's email address. Must be provided if username is not provided.",
type: 'string',
example: 'user@example.com',
},
name: {
description: "The user's name (not the user's username).",
type: 'string',
example: 'Sam Seawright',
},
rootRole: {
description:
"The role to assign to the user. Can be either the role's ID or its unique name.",
oneOf: [
{
type: 'integer',
example: 1,
minimum: 0,
},
{
type: 'string',
example: 'Admin',
enum: ['Admin', 'Editor', 'Viewer', 'Owner', 'Member'],
},
],
},
},
components: {},
} as const;
export type UpdateUserSchema = FromSchema<typeof updateUserSchema>;