mirror of
https://github.com/Unleash/unleash.git
synced 2025-12-21 20:06:40 +01:00
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"
]
}
```
23 lines
715 B
TypeScript
23 lines
715 B
TypeScript
import { FromSchema } from 'json-schema-to-ts';
|
|
|
|
export const tokenStringListSchema = {
|
|
$id: '#/components/schemas/tokenStringListSchema',
|
|
type: 'object',
|
|
description: 'A list of unleash tokens to validate against known tokens',
|
|
required: ['tokens'],
|
|
properties: {
|
|
tokens: {
|
|
description: 'Tokens that we want to get access information about',
|
|
type: 'array',
|
|
items: { type: 'string' },
|
|
example: [
|
|
'aproject:development.randomstring',
|
|
'[]:production.randomstring',
|
|
],
|
|
},
|
|
},
|
|
components: {},
|
|
} as const;
|
|
|
|
export type TokenStringListSchema = FromSchema<typeof tokenStringListSchema>;
|