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

ResourceSnippet does not support PayloadSubsectionExtractor #229

Open
antoinelochet opened this issue Feb 23, 2023 · 1 comment
Open

ResourceSnippet does not support PayloadSubsectionExtractor #229

antoinelochet opened this issue Feb 23, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@antoinelochet
Copy link

antoinelochet commented Feb 23, 2023

Hello,

When migrating from vanilla Spring REST Doc to this plugin, we encountered a problem with PayloadSubsectionExtractor.
It is not used at all.
Here is our exemple:

document("example",
        RequestDocumentation.pathParameters(
                DocumentationHelper.tokenIdPathParameterDescriptor()
        ),
        PayloadDocumentation.requestFields(
                DocumentationHelper.keyAttributesFieldDescriptor()
        ),
        PayloadDocumentation.relaxedResponseFields(
                PayloadDocumentation.beneathPath("[]"),
                DocumentationHelper.keyTypeFieldDescriptor(),
                DocumentationHelper.keyIdFieldDescriptor(),
                DocumentationHelper.keySizeFieldDescriptor("size"),
                DocumentationHelper.curveOIDFieldDescriptor().type(String.class).optional(),
                DocumentationHelper.publicKeyFieldDescriptor(),
                DocumentationHelper.privateKeyFieldDescriptor()
        ),
        PayloadDocumentation.responseFields(
                PayloadDocumentation.beneathPath("[].privateKey"),
                DocumentationHelper.keyUsagesFieldDescriptor(),
                DocumentationHelper.keyAttributesFieldDescriptor()
        ),
        PayloadDocumentation.responseFields(
                PayloadDocumentation.beneathPath("[].publicKey"),
                DocumentationHelper.rsaPublicKeyDetailsFieldDescriptors()
        )
)

The PayloadDocumentation.beneathPath("[]") is not used at all, which result in multiple errors with fields not found.
We have seen in the documentation that it would be possible to use subsectionWithPath or fieldWithPath but since MockMvcRestDocumentationWrapper is described to be a drop-in replacement, we do not want to go this route.

@ozscheyge ozscheyge added the bug Something isn't working label Feb 24, 2023
@philipowen
Copy link
Contributor

Hey @ozscheyge would you be able to review a PR to address this so that beneathPath() gets treated as expected?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants