Skip to content

New Feature: Support for variable contexts on URIs #1359

@pkordis-r7

Description

@pkordis-r7

It would be nice if via an annotation at class or method level, there could be a means of specifying an implentation that could supply dynamic values to contexts. Consider the following examples:

@VariableContext(alias = "varCtx", supplier = TheValueSupplier.class)
public class Example {

    @Headers({
        "accept: application/json",
    })
    @RequestLine("GET /api/{varCtx}/someEntity/{id}")
    SomeEntity getById(@Param("id") Long id);

}

As it is obvious, the {varCtx} does not need to be passed explicitely via the method's argument. It would also be nice to give the same annotation precedence if placed over a method while one is marking the enclosing class too.

I think this is very handy for cases where a dynamic switch of APIs is needed e.g. between versions (/api/v1/my/path to /api/v2/my/path) or other circumstances (/api/my/path to /api/session/my/path)

Metadata

Metadata

Assignees

No one assigned

    Labels

    proposalProposed Specification or API changewaiting for votesEnhancements or changes proposed that need more support before consideration

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions