是否有规范或惯例要求在URL中放置swagger.json
(或者其他已经约定好的名称),以便公共API可以自动发现我的网站?
是否有规范或惯例要求在URL中放置swagger.json
(或者其他已经约定好的名称),以便公共API可以自动发现我的网站?
swagger.json
,3.0版本则更改为openapi.json
。希望能有所帮助。OpenAPI Wiki 建议至少在服务器API中使用
/api-docs
端点。我已经在很多网站上看到过这种用法,而且这也是我们公司的标准。
好的。OpenAPI 3.0仍然缺乏自动发现机制,我尝试提出一种基于已经运行的一些东西的方案:
https://example.com/.well-known/schema-discovery
is a JSON document pointing to array of available schemas:
[
{
"schema_url": "/openapi.json",
"schema_type": "openapi-3.0"
},
{
"schema_url": "/v2/openapi.json",
"schema_type": "openapi-3.0"
}
]
If there is only one version of API, then https://example.com/openapi.json
should be enough.
HTTP Headers. I remember somebody from Google proposed HTTP header for pointing to API. If you can find or remember it, please tell me.