ePages-de / restdocs-raml

Adds RAML support for Spring REST Docs
MIT License
27 stars 7 forks source link

Fix handling of multiple hrefs for a link #27

Closed ulfsauer0815 closed 6 years ago

ulfsauer0815 commented 6 years ago

When multiple refs are present for one link, the link's content will not be an object with two properties (rel and href), but an array containing multiple of these. The test will fail with the message: org.springframework.restdocs.payload.FieldTypesDoNotMatchException: The documented type of the field '_links.multiple' is Object but the actual type is Array

There is an additional generateModel pass, which includes validation of type information, but this time including FieldDescriptors created from LinkDescriptors. See https://github.com/ePages-de/restdocs-raml/blob/afd9f1aca4710cc6154d7569d4adf586de689123/restdocs-raml/src/main/java/com/epages/restdocs/raml/ResponseHandler.java#L46

The expected type is set to OBJECT, which will be ARRAY when multiple hrefs for a link are present.

coveralls commented 6 years ago

Coverage Status

Coverage remained the same at 93.585% when pulling 8362d7d42637125dabac2b5d13733cea5e721b4a on UlfS:fix/multiple-hrefs-in-links-not-working into afd9f1aca4710cc6154d7569d4adf586de689123 on ePages-de:master.