相关疑难解决方法(0)

来自Spring Hateoas的文件HAL"_links"(带着招摇)?

我有一个REST服务,我想为我的客户开发团队记录.

所以我加了一些LinksSpring-Hateoas我的资源API,并插入到它swagger-springmvc @Api...注解来记录一切,使一个很好的API参考我的角团队能够理解我的REST服务.

问题是swagger无法发现可能的链接,只是给我一大堆Links而不说他们可能的价值观.

这是一个(简单)的例子.Swagger检测到:

Model Schema
CollectionListResource {
    collections (array[CollectionResource]): All available collections,
    links (array[Link]): Relations for next actions
}
CollectionResource {
    collectionId (string): Collection Unique Id,
    name (string): Human readable collection name,
    links (array[Link]): Relations for next actions
}
Link {
    rel (string, optional),
    templated (boolean, optional),
    href (string, optional)
} 
Run Code Online (Sandbox Code Playgroud)

我实际上在HAL中:

 {"collections":
    [{"collectionId":"5370a206b399c65f05a7c59e",
      "name":"default",
       "_links":{ [
           "self":{
              "href":"http://localhost:9080/collections/5370a206b399c65f05a7c59e"
            },

           "delete":{
              "href":"http://localhost:9080/collections/5370a206b399c65f05a7c59e"
            }
        ]}
       }, ...]}   
Run Code Online (Sandbox Code Playgroud)

我试图扩展Link …

documentation spring spring-mvc swagger spring-hateoas

10
推荐指数
1
解决办法
6513
查看次数