source2swagger は、1 つの json ファイルにすべての API を含む swagger 仕様を生成します。swagger-ui は実際にそれを使用できますか? 生成された json ファイルを swagger-ui で探索すると、単一の json ファイルの説明/操作を使用するのではなく、仕様のパスから API の説明を読み取ろうとします。
質問する
1092 次
1 に答える
0
Swagger-UI は、すべての json を 1 つのファイルに入れることを処理します。ただし、最上位のリソース リストが複数存在する可能性があるかどうかはまだわかりません。
これが実際の例です:
{"basePath":"http://localhost:3001/", "resourcePath":"/", "swaggerVersion":"1.1", "apiVersion":"1.0", "apis":[
{
"path":"/pay",
"format":"json",
"description":"Create a transaction with the given amount and token.",
"operations":[
{
"httpMethod":"GET",
"tags":["production"],
"nickname":"pay",
"deprecated":false,
"summary":"Create a transaction with the given amount and token.",
"parameters":[
{
"name":"token",
"description":"The token representing the pay card",
"dataType":"string",
"allowMultiple":false,
"required":true,
"paramType":"query"
},
{
"name":"amount",
"description":"The amount to pay",
"dataType":"string",
"allowMultiple":false,
"required":true,
"paramType":"query"
}
]
}
]
},
{
"path":"/customer",
"format":"json",
"description":"Create an HTML form for adding a customer.",
"operations":[
{
"httpMethod":"GET",
"tags":["production"],
"nickname":"createCustomerForm",
"deprecated":false,
"summary":"Create an HTML form for adding a customer.",
"parameters":[
{
"name":"customerId",
"description":"Your customer id",
"dataType":"string",
"allowMultiple":false,
"required":true,
"paramType":"query"
}
]
}
]
},
{
"path":"/customer/{customerId}",
"format":"json",
"description":"Delete the customer info for given id.",
"operations":[
{
"httpMethod":"DELETE",
"tags":["production"],
"nickname":"deleteCustomer",
"deprecated":false,
"summary":"Delete the customer info for given id.",
"parameters":[
{
"name":"customerId",
"description":"the customer id to delete",
"dataType":"string",
"allowMultiple":false,
"required":true,
"paramType":"path"
}
]
}
]
},
{
"path":"/card",
"format":"json",
"description":"Create an HTML form for adding a credit card.",
"operations":[
{
"httpMethod":"GET",
"tags":["production"],
"nickname":"createCardForm",
"deprecated":false,
"summary":"Create an HTML form for the given customer to add a credit card.",
"parameters":[
{
"name":"customerId",
"description":"Your customer id",
"dataType":"string",
"allowMultiple":false,
"required":true,
"paramType":"query"
}
]
}
]
},
{
"path":"/card/{token}",
"format":"json",
"description":"Delete a card record by token.",
"operations":[
{
"httpMethod":"DELETE",
"tags":["production"],
"nickname":"deleteCard",
"deprecated":false,
"summary":"Delete the card info for given token.",
"parameters":[
{
"name":"token",
"description":"the token to delete",
"dataType":"string",
"allowMultiple":false,
"required":true,
"paramType":"path"
}
]
}
]
}
]}
于 2013-03-01T15:40:11.113 に答える