我正在定义此结构:
openapi.yaml
paths:
/my-path/my-resource:
$ref: './api/my-resource.yaml#/my-operations'
/another-path/another-resource:
$ref: './api/my-resource.yaml#/my-operations/get'
my-resource.yaml
my-operations:
get:
tags:
- my-api
operationId: getMyResource
responses:
...
[omitted]
...
post:
tags:
- my-api
operationId: postMyResource
responses:
...
[omitted]
...
现在,我想引用“ / my-path / my-resource”中之前定义的“ / another-path / another-resource” get的操作。会是这样的:
/another-path/another-resource:
$ref: '#/paths/my-path~1my-resource/get'
或
/another-path/another-resource:
$ref: '#/paths/my-path~1my-resource#/get'
或
/another-path/another-resource:
$ref: './api/my-resource.yaml#/my-operations/get'
或
/another-path/another-resource:
$ref: './api/my-resource.yaml#/my-operations#/get'
但是我这样做是因为什么都不起作用,我该怎么办?
非常感谢您。