Skip to content

Commit

Permalink
fix: Swagger 下透传其路径参数、查询参数的类型出来 (close: #87)
Browse files Browse the repository at this point in the history
  • Loading branch information
fjc0k committed Nov 21, 2024
1 parent e8569ff commit e1f89a3
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/swaggerJsonToYApiData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@ async function handleSwaggerData(res) {
})
}

async function run(
res,
): {
async function run(res): {
apis: Interface[]
cats: Category[]
basePath: string
Expand Down Expand Up @@ -266,9 +264,11 @@ function handleSwagger(data, originTags = []) {
if (param.in) {
switch (param.in) {
case 'path':
defaultParam.type = param.type
api.req_params.push(defaultParam)
break
case 'query':
defaultParam.type = param.type
api.req_query.push(defaultParam)
break
case 'body':
Expand Down Expand Up @@ -342,9 +342,7 @@ function handleResponse(api) {
return res_body
}

export async function swaggerJsonToYApiData(
data: any,
): Promise<{
export async function swaggerJsonToYApiData(data: any): Promise<{
project: Project
cats: Category[]
interfaces: Interface[]
Expand Down Expand Up @@ -374,8 +372,9 @@ export async function swaggerJsonToYApiData(
env: [
{
name: 'local',
domain: `${yapiData.swaggerData.schemes?.[0] || 'http'}://${yapiData
.swaggerData.host || '127.0.0.1'}`,
domain: `${yapiData.swaggerData.schemes?.[0] || 'http'}://${
yapiData.swaggerData.host || '127.0.0.1'
}`,
},
],
}
Expand Down

0 comments on commit e1f89a3

Please sign in to comment.