Include schemas in generated frontend client (#584)

This commit is contained in:
Alejandra
2024-01-22 15:16:21 -05:00
committed by GitHub
parent d91ed067a8
commit 6ecc8a06ec
16 changed files with 292 additions and 1 deletions

View File

@@ -8,7 +8,7 @@
"build": "tsc && vite build", "build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0", "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview", "preview": "vite preview",
"generate-client": "openapi --input ./openapi.json --useOptions --useUnionTypes --output ./src/client --client axios" "generate-client": "openapi --input ./openapi.json --useOptions --useUnionTypes --output ./src/client --client axios --exportSchemas true"
}, },
"dependencies": { "dependencies": {
"axios": "1.6.2", "axios": "1.6.2",

View File

@@ -22,6 +22,21 @@ export type { UserUpdate } from './models/UserUpdate';
export type { UserUpdateMe } from './models/UserUpdateMe'; export type { UserUpdateMe } from './models/UserUpdateMe';
export type { ValidationError } from './models/ValidationError'; export type { ValidationError } from './models/ValidationError';
export { $Body_login_login_access_token } from './schemas/$Body_login_login_access_token';
export { $HTTPValidationError } from './schemas/$HTTPValidationError';
export { $ItemCreate } from './schemas/$ItemCreate';
export { $ItemOut } from './schemas/$ItemOut';
export { $ItemUpdate } from './schemas/$ItemUpdate';
export { $Message } from './schemas/$Message';
export { $NewPassword } from './schemas/$NewPassword';
export { $Token } from './schemas/$Token';
export { $UserCreate } from './schemas/$UserCreate';
export { $UserCreateOpen } from './schemas/$UserCreateOpen';
export { $UserOut } from './schemas/$UserOut';
export { $UserUpdate } from './schemas/$UserUpdate';
export { $UserUpdateMe } from './schemas/$UserUpdateMe';
export { $ValidationError } from './schemas/$ValidationError';
export { ItemsService } from './services/ItemsService'; export { ItemsService } from './services/ItemsService';
export { LoginService } from './services/LoginService'; export { LoginService } from './services/LoginService';
export { UsersService } from './services/UsersService'; export { UsersService } from './services/UsersService';

View File

@@ -0,0 +1,29 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export const $Body_login_login_access_token = {
properties: {
grant_type: {
type: 'string',
pattern: 'password',
},
username: {
type: 'string',
isRequired: true,
},
password: {
type: 'string',
isRequired: true,
},
scope: {
type: 'string',
},
client_id: {
type: 'string',
},
client_secret: {
type: 'string',
},
},
} as const;

View File

@@ -0,0 +1,14 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export const $HTTPValidationError = {
properties: {
detail: {
type: 'array',
contains: {
type: 'ValidationError',
},
},
},
} as const;

View File

@@ -0,0 +1,15 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export const $ItemCreate = {
properties: {
title: {
type: 'string',
isRequired: true,
},
description: {
type: 'string',
},
},
} as const;

View File

@@ -0,0 +1,19 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export const $ItemOut = {
properties: {
title: {
type: 'string',
isRequired: true,
},
description: {
type: 'string',
},
id: {
type: 'number',
isRequired: true,
},
},
} as const;

View File

@@ -0,0 +1,14 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export const $ItemUpdate = {
properties: {
title: {
type: 'string',
},
description: {
type: 'string',
},
},
} as const;

View File

@@ -0,0 +1,12 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export const $Message = {
properties: {
message: {
type: 'string',
isRequired: true,
},
},
} as const;

View File

@@ -0,0 +1,16 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export const $NewPassword = {
properties: {
token: {
type: 'string',
isRequired: true,
},
new_password: {
type: 'string',
isRequired: true,
},
},
} as const;

View File

@@ -0,0 +1,15 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export const $Token = {
properties: {
access_token: {
type: 'string',
isRequired: true,
},
token_type: {
type: 'string',
},
},
} as const;

View File

@@ -0,0 +1,26 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export const $UserCreate = {
properties: {
email: {
type: 'string',
isRequired: true,
format: 'email',
},
is_active: {
type: 'boolean',
},
is_superuser: {
type: 'boolean',
},
full_name: {
type: 'string',
},
password: {
type: 'string',
isRequired: true,
},
},
} as const;

View File

@@ -0,0 +1,20 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export const $UserCreateOpen = {
properties: {
email: {
type: 'string',
isRequired: true,
format: 'email',
},
password: {
type: 'string',
isRequired: true,
},
full_name: {
type: 'string',
},
},
} as const;

View File

@@ -0,0 +1,26 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export const $UserOut = {
properties: {
email: {
type: 'string',
isRequired: true,
format: 'email',
},
is_active: {
type: 'boolean',
},
is_superuser: {
type: 'boolean',
},
full_name: {
type: 'string',
},
id: {
type: 'number',
isRequired: true,
},
},
} as const;

View File

@@ -0,0 +1,24 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export const $UserUpdate = {
properties: {
email: {
type: 'string',
format: 'email',
},
is_active: {
type: 'boolean',
},
is_superuser: {
type: 'boolean',
},
full_name: {
type: 'string',
},
password: {
type: 'string',
},
},
} as const;

View File

@@ -0,0 +1,18 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export const $UserUpdateMe = {
properties: {
password: {
type: 'string',
},
full_name: {
type: 'string',
},
email: {
type: 'string',
format: 'email',
},
},
} as const;

View File

@@ -0,0 +1,28 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */
export const $ValidationError = {
properties: {
loc: {
type: 'array',
contains: {
type: 'any-of',
contains: [{
type: 'string',
}, {
type: 'number',
}],
},
isRequired: true,
},
msg: {
type: 'string',
isRequired: true,
},
type: {
type: 'string',
isRequired: true,
},
},
} as const;