How to use $ref to reference a path from another OpenAPI file?

前端 未结 1 360
花落未央
花落未央 2021-01-22 10:11

Here it says I could refer to the definition in another file for an individual path, but the example seems to refer to a whole file, instead of a single path definition under th

1条回答
  •  一向
    一向 (楼主)
    2021-01-22 10:45

    When referencing paths, you need to escape the path name by replacing / with ~1, so that /a/b becomes ~1a~1b. Note that you escape just the path name and not the #/paths/ prefix.

    $ref: 'Anotherfile.yaml#/paths/~1a~1b'
    

    0 讨论(0)
提交回复
热议问题