swagger-api / swagger-api/swagger-core

Support Bean Validation for Maps' generic parameter are ignored

Open
#4,447 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

backlog
Dominant language
Java
Stars
7.5k
Forks
2.3k
Avg merge
18h 1m
Merged PRs (30d)
10

Description

While validation annotations of generic parameters are now supported for Optionals and Array-like structures (see https://github.com/swagger-api/swagger-core/pull/4373) that is not the case for Map structures.

Example:

@NotNull private final Map<Integer, @NotNull BigDecimal> vintages;

will produce an OpenAPI specification:

"vintages":{"type":"object","additionalProperties":{"type":"number"}}

Any annotation on the Map's value is ignored.

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.

Research direction

Start by tracing how generic parameter annotations are handled for Optionals and array-like structures, then compare that path with Map value processing. Use the provided Map<Integer, @NotNull BigDecimal> example as a regression case; done means the generated OpenAPI additionalProperties reflects the value annotation rather than ignoring it.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.