Why does the getPaths method of Swagger Parser not return all paths?

前端 未结 1 573
走了就别回头了
走了就别回头了 2020-12-21 16:33

I have a Swagger 1.2 doc.json and the following Java code which uses Swagger Parser to extract all the paths from this document. The problem is that the parser does not get

相关标签:
1条回答
  • 2020-12-21 17:13

    There are duplicate paths in your API definition, for example:

    "path": "api/v2/nodes/{id}",
    "description": "Get a node",
    ...
    "path": "api/v2/nodes/{id}",
    "description": "Get a virtual folder",
    
    "path": "api/v2/nodes/actions",
    "description": "Get actions for the selected node IDs",
    ...
    "path": "api/v2/nodes/actions",
    "description": "Get actions for the selected node IDs",
    

    Duplicate paths are not allowed by the Swagger 1.2 Specification:

    In the apis array, there MUST be only one API Object per path.

    The parser simply ignores the duplicates.

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