jakartaee / jakartaee/rest

@HttpMethod should guess value if omitted

Open
#23 6 comments 0 reactions 1 assignee View on GitHub

@glassfishrobot is already working on this.

Since Feb 10, 2018.

Dominant language
Java
Stars
400
Forks
143
PR merge metrics
No merged PRs in 30d

Description

Typically, JAX-RS methods are defined by a 1:1 relation between the
annotation's (@interface's) name, and the same name provided in the @HttpMethod
value:

@HttpMethod("FOOBAR")
public @interface FOOBAR {
}

As it is rather tedious and error-prone to always repeat the same string twice,
it would be a nice feature if by default the @HttpMethod would expect this name
equalness if the value attribute was left out:

@HttpMethod // implies value="FOOBAR" by default
public @interface FOOBAR {
}

The reduces the possibility of typos (unintentional deviation of @HttpMethod's
value and annotation's interface name) and is less boring.

As this is not a major feature but just a slight improvement, and as this is
does not break the binary backwards compatibility, I want to propose the
adoption of this minor feature into JSR311 Maintenance Release 1.2.

Environment

Operating System: All
Platform: All

Affected Versions

[2.1]

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.