Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

question for request/response fields snippet with ResourceSnippetParameters #206

Open
royaljs opened this issue Jun 29, 2022 · 1 comment

Comments

@royaljs
Copy link

royaljs commented Jun 29, 2022

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?

@dineshsampangi
Copy link

Yeah i have the same concern, anyone can respond? The documentation just mentions to replace the "MockMvcRestDocumentation" with the wrapper , using the resource and ResourcesnippetParameters builder is a must?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants