mirror of
https://github.com/Unleash/unleash.git
synced 2025-05-03 01:18:43 +02:00
https://linear.app/unleash/issue/SR-379/refactor-pats This PR refactors PATs. - Adds a new `createPatSchema`, which better aligns with https://docs.getunleash.io/contributing/ADRs/overarching/separation-request-response-schemas - Drops the model type and class in favor of using the schema types directly, which is more consistent with the rest of the codebase and easier to maintain - Misc scouting, improvement and fixes This breaks Enterprise temporarily, but it's faster to move forward this way.
26 lines
749 B
TypeScript
26 lines
749 B
TypeScript
import { FromSchema } from 'json-schema-to-ts';
|
|
import { patSchema } from './pat-schema';
|
|
|
|
export const patsSchema = {
|
|
$id: '#/components/schemas/patsSchema',
|
|
type: 'object',
|
|
description:
|
|
'Contains a collection of [personal access tokens](https://docs.getunleash.io/how-to/how-to-create-personal-access-tokens), or PATs. PATs are automatically scoped to the authenticated user.',
|
|
properties: {
|
|
pats: {
|
|
type: 'array',
|
|
description: 'A collection of PATs.',
|
|
items: {
|
|
$ref: patSchema.$id,
|
|
},
|
|
},
|
|
},
|
|
components: {
|
|
schemas: {
|
|
patSchema,
|
|
},
|
|
},
|
|
} as const;
|
|
|
|
export type PatsSchema = FromSchema<typeof patsSchema>;
|