ePages-de / ePages-de/restdocs-api-spec

question for request/response fields snippet with ResourceSnippetParameters

Open
#206 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
Kotlin
Stars
427
Forks
116
Avg merge
23h 54m
Merged PRs (30d)
1

Description

Hi. I have a question about generating request/response fields snippets with MockMvcRestDocumentationWrapper.

I'd expected documenting with only MockMvcRestDocumentationWrapper and ResourceSnippetParameters, but request/response fields snippets were not generated at build time while other snippets(parameters, etc) were successfully generated. (Code right below)

```
andDo(MockMvcRestDocumentationWrapper.document("onOrderApproved",
resource(ResourceSnippetParameters.builder()
.requestFields(
fieldWithPath("approvalNumber"),
fieldWithPath("expectedAt")
)
.responseFields(
fieldWithPath("code"),
fieldWithPath("message")
.requestSchema(new Schema("OrderApproveRequest"))
.responseSchema(new Schema("OrderApproveResponse"))
.build()
)))
```

However, adding MockMvcRestDocumentationWrapper.document without ResourceSnippetParameters, request/response fields snippets are successfully generated. (Code right below)

```
andDo(MockMvcRestDocumentationWrapper.document("onOrderApproved",
requestFields(
fieldWithPath("approvalNumber"),
fieldWithPath("expectedAt")
),
responseFields(
fieldWithPath("code"),
fieldWithPath("message")
))
)
.andDo(MockMvcRestDocumentationWrapper.document("onOrderApproved",
resource(ResourceSnippetParameters.builder()
.requestFields(
fieldWithPath("approvalNumber"),
fieldWithPath("expectedAt")
)
.responseFields(
fieldWithPath("code"),
fieldWithPath("message")
.requestSchema(new Schema("OrderApproveRequest"))
.responseSchema(new Schema("OrderApproveResponse"))
.build()
)))
```

Is there any other way to generate all necessary snippets with only one set of MockMvcRestDocumentationWrapper.document code per an API?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.