Skip to content

Commit 705b6ef

Browse files
authored
✨ Include schemas in generated frontend client (fastapi#584)
1 parent 9b2d40b commit 705b6ef

16 files changed

Lines changed: 292 additions & 1 deletion

src/new-frontend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"build": "tsc && vite build",
99
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
1010
"preview": "vite preview",
11-
"generate-client": "openapi --input ./openapi.json --useOptions --useUnionTypes --output ./src/client --client axios"
11+
"generate-client": "openapi --input ./openapi.json --useOptions --useUnionTypes --output ./src/client --client axios --exportSchemas true"
1212
},
1313
"dependencies": {
1414
"axios": "1.6.2",

src/new-frontend/src/client/index.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,21 @@ export type { UserUpdate } from './models/UserUpdate';
2222
export type { UserUpdateMe } from './models/UserUpdateMe';
2323
export type { ValidationError } from './models/ValidationError';
2424

25+
export { $Body_login_login_access_token } from './schemas/$Body_login_login_access_token';
26+
export { $HTTPValidationError } from './schemas/$HTTPValidationError';
27+
export { $ItemCreate } from './schemas/$ItemCreate';
28+
export { $ItemOut } from './schemas/$ItemOut';
29+
export { $ItemUpdate } from './schemas/$ItemUpdate';
30+
export { $Message } from './schemas/$Message';
31+
export { $NewPassword } from './schemas/$NewPassword';
32+
export { $Token } from './schemas/$Token';
33+
export { $UserCreate } from './schemas/$UserCreate';
34+
export { $UserCreateOpen } from './schemas/$UserCreateOpen';
35+
export { $UserOut } from './schemas/$UserOut';
36+
export { $UserUpdate } from './schemas/$UserUpdate';
37+
export { $UserUpdateMe } from './schemas/$UserUpdateMe';
38+
export { $ValidationError } from './schemas/$ValidationError';
39+
2540
export { ItemsService } from './services/ItemsService';
2641
export { LoginService } from './services/LoginService';
2742
export { UsersService } from './services/UsersService';
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/* generated using openapi-typescript-codegen -- do no edit */
2+
/* istanbul ignore file */
3+
/* tslint:disable */
4+
/* eslint-disable */
5+
export const $Body_login_login_access_token = {
6+
properties: {
7+
grant_type: {
8+
type: 'string',
9+
pattern: 'password',
10+
},
11+
username: {
12+
type: 'string',
13+
isRequired: true,
14+
},
15+
password: {
16+
type: 'string',
17+
isRequired: true,
18+
},
19+
scope: {
20+
type: 'string',
21+
},
22+
client_id: {
23+
type: 'string',
24+
},
25+
client_secret: {
26+
type: 'string',
27+
},
28+
},
29+
} as const;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/* generated using openapi-typescript-codegen -- do no edit */
2+
/* istanbul ignore file */
3+
/* tslint:disable */
4+
/* eslint-disable */
5+
export const $HTTPValidationError = {
6+
properties: {
7+
detail: {
8+
type: 'array',
9+
contains: {
10+
type: 'ValidationError',
11+
},
12+
},
13+
},
14+
} as const;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/* generated using openapi-typescript-codegen -- do no edit */
2+
/* istanbul ignore file */
3+
/* tslint:disable */
4+
/* eslint-disable */
5+
export const $ItemCreate = {
6+
properties: {
7+
title: {
8+
type: 'string',
9+
isRequired: true,
10+
},
11+
description: {
12+
type: 'string',
13+
},
14+
},
15+
} as const;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/* generated using openapi-typescript-codegen -- do no edit */
2+
/* istanbul ignore file */
3+
/* tslint:disable */
4+
/* eslint-disable */
5+
export const $ItemOut = {
6+
properties: {
7+
title: {
8+
type: 'string',
9+
isRequired: true,
10+
},
11+
description: {
12+
type: 'string',
13+
},
14+
id: {
15+
type: 'number',
16+
isRequired: true,
17+
},
18+
},
19+
} as const;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/* generated using openapi-typescript-codegen -- do no edit */
2+
/* istanbul ignore file */
3+
/* tslint:disable */
4+
/* eslint-disable */
5+
export const $ItemUpdate = {
6+
properties: {
7+
title: {
8+
type: 'string',
9+
},
10+
description: {
11+
type: 'string',
12+
},
13+
},
14+
} as const;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/* generated using openapi-typescript-codegen -- do no edit */
2+
/* istanbul ignore file */
3+
/* tslint:disable */
4+
/* eslint-disable */
5+
export const $Message = {
6+
properties: {
7+
message: {
8+
type: 'string',
9+
isRequired: true,
10+
},
11+
},
12+
} as const;
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
/* generated using openapi-typescript-codegen -- do no edit */
2+
/* istanbul ignore file */
3+
/* tslint:disable */
4+
/* eslint-disable */
5+
export const $NewPassword = {
6+
properties: {
7+
token: {
8+
type: 'string',
9+
isRequired: true,
10+
},
11+
new_password: {
12+
type: 'string',
13+
isRequired: true,
14+
},
15+
},
16+
} as const;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/* generated using openapi-typescript-codegen -- do no edit */
2+
/* istanbul ignore file */
3+
/* tslint:disable */
4+
/* eslint-disable */
5+
export const $Token = {
6+
properties: {
7+
access_token: {
8+
type: 'string',
9+
isRequired: true,
10+
},
11+
token_type: {
12+
type: 'string',
13+
},
14+
},
15+
} as const;

0 commit comments

Comments
 (0)