spring-restdocs icon indicating copy to clipboard operation
spring-restdocs copied to clipboard

Support array indices in JSON field paths

Open mariusoe opened this issue 8 years ago • 3 comments

Hi,

when using a PayloadSubsectionExtractor (e.g. FieldPathPayloadSubsectionExtractor) to extract a subsection of a JSON payload, array indices are ignored.

I would assume that when a path is used like Outer[].Nested[0].Attribute only the first (in this example Nested) element or which is matching the specified index will match the given path and, thus, returned. But it extracts always all elements which results in a PayloadHandlingException({PATH} + " does not uniquely identify a subsection of the payload").

mariusoe avatar Dec 15 '17 08:12 mariusoe

That's working as (currently) designed. There's no support for array indices anywhere in REST Docs at the moment.

wilkinsona avatar Jan 02 '18 10:01 wilkinsona

+1 from me for the enhancement request

dibog avatar May 11 '20 15:05 dibog