swagger-api / swagger-api/swagger-codegen-generators

[JavaSpring] Should use requiredMode instead of deprecated required attribute of Schema class

Open
#1,402 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug
Dominant language
Mustache
Stars
299
Forks
439
PR merge metrics
No merged PRs in 30d

Description

Description

When using spring in the recent versions of swagger-codegen-generators, we get a lot of deprecation warnings about the required attribute of the Schema class being deprecated.

/path/to/project/build/generated/sources/swagger/java/main/com/example/api/model/Info.java:57: warning: [deprecation] required() in Schema has been deprecated
  @Schema(required = true, description = "Name")

Version

1.0.60

Can you identify when the issue first appeared?

Not yet, but I'll get back to you

Language / Generator Affected

Spring (and possibly other Java based generators too)

Additional Context

Checklist

  • I have searched the existing issues to avoid duplicates.
  • I have included a minimal reproducible spec or configuration.
  • I have clearly described the steps to reproduce the issue.
  • I have specified which generator or template is affected.

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 with the Spring generator that produces the generated Info.java example and locate where its @Schema annotation is assembled. Check the generated annotation for the deprecated required attribute, then verify that the output uses requiredMode and no longer emits the deprecation warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
api, backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.