Skip to content

Snippet Link Validation Does Not Allow Use of Custom LinkExtractor #154

@romeara

Description

@romeara

Currently, if links are marked as required, but are not formatted as HAL links, documentation generation will fail on the ResponseSnippet validation step. Spring REST docs itself allows providing a specific link extractor to handle different response formats. In the case which this was encountered for, the APIs in question are returning links in a specific format due to constraints outside my control, so aside from the compatibility and workload issues, converting to the more standard response style isn't an option, which is why for the standard REST doc operations we are providing a custom link extractor.

The issue specifically is in DescriptorValidator.LinksSnippetWrapper, which is currently hard-coded to use HypermediaDocumentation.halLinks(). Ideally, this would be an overridable default.

My suggestion to resolve this would be to add a linkExtractor field to ResourceSnippetParameters (and its builder) which defaults to HypermediaDocumentation.halLinks(), and is passed in as a parameter to the DescriptorValidator operation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestwontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions