Как манипулировать полями в `_templates`, введенными` spring-hateoas` - PullRequest
0 голосов
/ 12 апреля 2019

Я настраиваю приложение Spring Boot с Kotlin, чтобы сделать его управляемым гипермедиа с типом носителя HAL-FROMS .Посмотрел новый недавний выпуск spring-hateoas - 1.0.0.M1 .

Не могу найти документацию или примеры, которые бы показывали, как установить _templates детали.Документация показывает пример кода, который может заставить приложение отвечать с телами вроде:

...

"_templates" : {
    "default" : {
      "title" : null, <-- how to set?
      "method" : "put",
      "contentType" : "", <-- how to set?
      "properties" : [ {
        "name" : "firstName",
        "required" : true
      }, {
        "name" : "lastName",
        "required" : true
      }, {
        "name" : "role",
        "required" : true <-- how to make optional?
      } ]
    },

...

Как я могу взять код из https://github.com/spring-projects/spring-hateoas-examples/tree/master/affordances и заставить его возвращать тела какниже?

...

"_templates" : {
    "default" : {
      "title" : "Create new user"
      "method" : "put",
      "contentType" : "application/json"
      "properties" : [ {
        "name" : "firstName",
        "required" : true
      }, {
        "name" : "lastName",
        "required" : true
      }, {
        "name" : "role",
        "required" : false
      } ]
    },

...

...