-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
geekact
committed
Jul 16, 2024
1 parent
d0a7fd9
commit 7350225
Showing
58 changed files
with
4,982 additions
and
3,648 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { ConsoleApp } from '@aomex/console'; | ||
import { openapi } from '@aomex/openapi'; | ||
|
||
const app = new ConsoleApp({ | ||
mount: [ | ||
openapi({ | ||
commandName: 'openapi-json', | ||
routers: ['./openapi/routers'], | ||
saveToFile: './openapi/openapi.json', | ||
docs: { | ||
openapi: '3.0.3', | ||
info: { | ||
version: '0.0.0', | ||
}, | ||
}, | ||
}), | ||
openapi({ | ||
commandName: 'openapi-yaml', | ||
routers: ['./openapi/routers'], | ||
saveToFile: './openapi/openapi.yaml', | ||
docs: { | ||
openapi: '3.0.3', | ||
info: { | ||
version: '0.0.0', | ||
}, | ||
}, | ||
}), | ||
], | ||
}); | ||
|
||
const code = await app.run(); | ||
process.exit(code); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { defineConfig } from './src/define-config'; | ||
|
||
export default defineConfig({ | ||
path: './openapi/openapi.json', | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"openapi":"3.0.3","info":{"version":"0.0.0","title":"foca-openapi"},"tags":[{"name":"user"}],"paths":{"/users":{"get":{"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"page":{"type":"integer"},"limit":{"type":"integer"},"total":{"type":"integer"},"result":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer"},"name":{"description":"用户名","type":"string"},"age":{"nullable":true,"type":"integer"},"address":{"nullable":true,"type":"string"},"password":{"description":"即将删除","deprecated":true,"type":"string"}},"required":["id","name","age","password"]}}},"required":["page","limit","total","result"]}}}}},"parameters":[{"name":"page","in":"query","schema":{"default":1,"type":"integer","maximum":10,"minimum":1,"exclusiveMaximum":false,"exclusiveMinimum":false}},{"name":"limit","in":"query","description":"每页返回的资源数量","schema":{"description":"每页返回的资源数量","default":10,"type":"integer","maximum":100,"exclusiveMaximum":false}}],"tags":["user"],"operationId":"list_users"},"post":{"responses":{"201":{"description":"创建成功","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"integer"},"name":{"description":"用户名","type":"string"},"age":{"nullable":true,"type":"integer"},"address":{"nullable":true,"type":"string"},"password":{"description":"即将删除","deprecated":true,"type":"string"}},"required":["id","name","age","password"]}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"age":{"type":"integer"},"address":{"type":"integer"}},"required":["name"]}}},"required":true},"tags":["user"],"operationId":"create_users","x-codegen-request-body-name":"body"}},"/users/{id}":{"get":{"responses":{"200":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"integer"},"name":{"description":"用户名","type":"string"},"age":{"nullable":true,"type":"integer"},"address":{"nullable":true,"type":"string"},"password":{"description":"即将删除","deprecated":true,"type":"string"}},"required":["id","name","age","password"]}}}},"404":{"description":"用户不存在"}},"tags":["user"],"operationId":"retrieve_users_by_id"},"put":{"responses":{"200":{"description":"更新成功","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"integer"},"name":{"description":"用户名","type":"string"},"age":{"nullable":true,"type":"integer"},"address":{"nullable":true,"type":"string"},"password":{"description":"即将删除","deprecated":true,"type":"string"}},"required":["id","name","age","password"]}}}},"404":{"description":"用户不存在"}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"age":{"type":"integer"},"address":{"type":"integer"}},"required":["name"]}}},"required":true},"tags":["user"],"operationId":"replace_users_by_id"},"delete":{"responses":{"204":{"description":"删除成功"},"404":{"description":"用户不存在"}},"tags":["user"],"operationId":"delete_users_by_id"},"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","minimum":1,"exclusiveMinimum":false}}]},"/users/v1":{"post":{"deprecated":true,"description":"接口已弃用,请使用 /users","responses":{"201":{"description":"创建成功","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"integer"},"name":{"description":"用户名","type":"string"},"age":{"nullable":true,"type":"integer"},"address":{"nullable":true,"type":"string"},"password":{"description":"即将删除","deprecated":true,"type":"string"}},"required":["id","name","age","password"]}}}}},"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"age":{"type":"integer"},"address":{"type":"integer"}},"required":["name"]}}},"required":true},"tags":["user"],"operationId":"create_users_v_1","x-codegen-request-body-name":"body"}},"/users/avatar":{"put":{"responses":{"201":{"description":"","content":{"application/json":{"schema":{"type":"object","properties":{"url":{"type":"string"}},"required":["url"]}}}}},"requestBody":{"content":{"multipart/form-data":{"schema":{"type":"object","properties":{"file":{"type":"string","format":"binary"}},"required":["file"]}}},"required":true},"tags":["user"],"operationId":"replace_users_avatar"}}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,304 @@ | ||
openapi: 3.0.3 | ||
info: | ||
version: 0.0.0 | ||
title: foca-openapi | ||
tags: | ||
- name: user | ||
paths: | ||
/users: | ||
get: | ||
responses: | ||
"200": | ||
description: "" | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
page: | ||
type: integer | ||
limit: | ||
type: integer | ||
total: | ||
type: integer | ||
result: | ||
type: array | ||
items: | ||
type: object | ||
properties: | ||
id: | ||
type: integer | ||
name: | ||
description: 用户名 | ||
type: string | ||
age: | ||
nullable: true | ||
type: integer | ||
address: | ||
nullable: true | ||
type: string | ||
password: | ||
description: 即将删除 | ||
deprecated: true | ||
type: string | ||
required: | ||
- id | ||
- name | ||
- age | ||
- password | ||
required: | ||
- page | ||
- limit | ||
- total | ||
- result | ||
parameters: | ||
- name: page | ||
in: query | ||
schema: | ||
default: 1 | ||
type: integer | ||
maximum: 10 | ||
minimum: 1 | ||
exclusiveMaximum: false | ||
exclusiveMinimum: false | ||
- name: limit | ||
in: query | ||
description: 每页返回的资源数量 | ||
schema: | ||
description: 每页返回的资源数量 | ||
default: 10 | ||
type: integer | ||
maximum: 100 | ||
exclusiveMaximum: false | ||
tags: | ||
- user | ||
operationId: list_users | ||
post: | ||
responses: | ||
"201": | ||
description: 创建成功 | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
id: | ||
type: integer | ||
name: | ||
description: 用户名 | ||
type: string | ||
age: | ||
nullable: true | ||
type: integer | ||
address: | ||
nullable: true | ||
type: string | ||
password: | ||
description: 即将删除 | ||
deprecated: true | ||
type: string | ||
required: | ||
- id | ||
- name | ||
- age | ||
- password | ||
requestBody: | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
name: | ||
type: string | ||
age: | ||
type: integer | ||
address: | ||
type: integer | ||
required: | ||
- name | ||
required: true | ||
tags: | ||
- user | ||
operationId: create_users | ||
x-codegen-request-body-name: body | ||
/users/{id}: | ||
get: | ||
responses: | ||
"200": | ||
description: "" | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
id: | ||
type: integer | ||
name: | ||
description: 用户名 | ||
type: string | ||
age: | ||
nullable: true | ||
type: integer | ||
address: | ||
nullable: true | ||
type: string | ||
password: | ||
description: 即将删除 | ||
deprecated: true | ||
type: string | ||
required: | ||
- id | ||
- name | ||
- age | ||
- password | ||
"404": | ||
description: 用户不存在 | ||
tags: | ||
- user | ||
operationId: retrieve_users_by_id | ||
put: | ||
responses: | ||
"200": | ||
description: 更新成功 | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
id: | ||
type: integer | ||
name: | ||
description: 用户名 | ||
type: string | ||
age: | ||
nullable: true | ||
type: integer | ||
address: | ||
nullable: true | ||
type: string | ||
password: | ||
description: 即将删除 | ||
deprecated: true | ||
type: string | ||
required: | ||
- id | ||
- name | ||
- age | ||
- password | ||
"404": | ||
description: 用户不存在 | ||
requestBody: | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
name: | ||
type: string | ||
age: | ||
type: integer | ||
address: | ||
type: integer | ||
required: | ||
- name | ||
required: true | ||
tags: | ||
- user | ||
operationId: replace_users_by_id | ||
delete: | ||
responses: | ||
"204": | ||
description: 删除成功 | ||
"404": | ||
description: 用户不存在 | ||
tags: | ||
- user | ||
operationId: delete_users_by_id | ||
parameters: | ||
- name: id | ||
in: path | ||
required: true | ||
schema: | ||
type: integer | ||
minimum: 1 | ||
exclusiveMinimum: false | ||
/users/v1: | ||
post: | ||
deprecated: true | ||
description: 接口已弃用,请使用 /users | ||
responses: | ||
"201": | ||
description: 创建成功 | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
id: | ||
type: integer | ||
name: | ||
description: 用户名 | ||
type: string | ||
age: | ||
nullable: true | ||
type: integer | ||
address: | ||
nullable: true | ||
type: string | ||
password: | ||
description: 即将删除 | ||
deprecated: true | ||
type: string | ||
required: | ||
- id | ||
- name | ||
- age | ||
- password | ||
requestBody: | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
name: | ||
type: string | ||
age: | ||
type: integer | ||
address: | ||
type: integer | ||
required: | ||
- name | ||
required: true | ||
tags: | ||
- user | ||
operationId: create_users_v_1 | ||
x-codegen-request-body-name: body | ||
/users/avatar: | ||
put: | ||
responses: | ||
"201": | ||
description: "" | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
url: | ||
type: string | ||
required: | ||
- url | ||
requestBody: | ||
content: | ||
multipart/form-data: | ||
schema: | ||
type: object | ||
properties: | ||
file: | ||
type: string | ||
format: binary | ||
required: | ||
- file | ||
required: true | ||
tags: | ||
- user | ||
operationId: replace_users_avatar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"type": "module" | ||
} |
Oops, something went wrong.