GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Empty default values are ignored · Issue #4838 · swagger-api/swagger-core

Empty default values are ignored #4838

New issue
Copy link
New issue
Copy link
Closed
Closed
Empty default values are ignored#4838
Copy link
Labels
backlog

Description

@westito
westito
opened on Jan 29, 2025
Issue body actions

Empty default values (@Schema(defaultValue = "")) are not included into generated OpenAPI yaml file.

Related code:

swagger-core/modules/swagger-core/src/main/java/io/swagger/v3/core/util/AnnotationsUtils.java

Line 751 in 55ef54d

if (StringUtils.isNotBlank(schema.defaultValue())) {

Empty values are simply ignored, but many code generation tools are rely on this value. For ex. in Dart generator when no default value provieded, the field became required at code level.

The defaultValue in @Schema annotation should be nullable and passing empty value means include in generated schema.

Reacted by Ludy

Activity

  1. juntae6942 commented on Sep 8, 2025

    @juntae6942
    juntae6942
    on Sep 8, 2025
    Contributor
    More actions

    westito I'd like to work on a fix for this. Could you please assign it to me?

  2. westito commented on Sep 17, 2025

    @westito
    westito
    on Sep 17, 2025
    Author
    More actions

    Feel free to fix

    Reacted by Bello🥔
    Reacted by Bello🥔
  3. daniel-kmiecik
    added
    Feature
    on Sep 18, 2025
  4. MichakrawSB
    added
    backlog
    on Feb 21, 2026
  5. daniel-kmiecik
    added 3 commits that reference this issue on Feb 25, 2026

    fix: add empty default value (#4838)

    cc6203b

    fix: add empty default value (#4838)

    6f33987

    fix: add empty default value (#4838)

    e80f727
  6. daniel-kmiecik commented on Feb 26, 2026

    @daniel-kmiecik
    daniel-kmiecik
    on Feb 26, 2026
    Collaborator
    More actions

    Thank you for raising this issue.
    Here's a prepared PR to fix it: #5063
    @juntae6942 many thanks for your engagement, but we need to avoid breaking change and your PR is not complete.

  7. daniel-kmiecik
    removed
    Feature
    on Feb 26, 2026
  8. daniel-kmiecik
    added a commit that references this issue on Feb 26, 2026

    fix: handle empty default value (#4838) (#5063)

    6043dd5
  9. daniel-kmiecik commented on Feb 26, 2026

    @daniel-kmiecik
    daniel-kmiecik
    on Feb 26, 2026
    Collaborator
    More actions

    The fix will be available with the next release. Thank you all!

    Reacted by Bello🥔
  10. daniel-kmiecik
    closed this as completedon Feb 26, 2026
  11. rbioteau commented on Mar 4, 2026

    @rbioteau
    rbioteau
    on Mar 4, 2026
    More actions

    Hi, just for the record, this change introduced a breaking change, if, like me, you are stuck on Springframework 5.x or Springboot 2.x.

    The latest version I can use of springdoc-openapi is 1.8.0 and it doesn't understand the new sentinel introduced in #5063.

    HTH

  12. MohTaheri commented on Mar 4, 2026

    @MohTaheri
    MohTaheri
    on Mar 4, 2026
    More actions

    Yes, that’s also breaking on our side after updating to the latest version of springdoc 3.0.2
    "400": description: "Bad Request" content: application/json: schema: $ref: "#/components/schemas/Error" additionalProperties: default: "##default" contains: default: "##default" default: "##default" items: default: "##default" unevaluatedItems: default: "##default"

    Reacted by Christopher Cudennec and Timon Back
  13. zdary commented on Mar 10, 2026

    @zdary
    zdary
    on Mar 10, 2026
    Contributor
    More actions

    @juntae6942 @westito this change broke default values rendering for enums badly.
    value ##default is rendered anywhere where default value was not defined at all.

    Image

    this used to be a drop box with possible enum values.

  14. daniel-kmiecik commented on Mar 10, 2026

    @daniel-kmiecik
    daniel-kmiecik
    on Mar 10, 2026
    Collaborator
    More actions

    Fix has been released. Please verify again.

  15. ahoehma commented on Mar 20, 2026

    @ahoehma
    ahoehma
    on Mar 20, 2026
    More actions

    I found that with the update of io.swagger.core.v3:swagger-annotations-jakarta 2.2.43 → 2.2.45 I have "##defaults" all over the place.

    I'm using org.springdoc:springdoc-openapi 3.0.1.

    Example:
    Image

    Any idea what I can do to avoid this?

    Reacted by Henrik Eriksson
  16. HenrikErikssonSU commented on Mar 24, 2026

    @HenrikErikssonSU
    HenrikErikssonSU
    on Mar 24, 2026
    More actions

    Thanks! I just run into the same issue.

  17. cesmarvin
    added a commit that references this issue on Oct 13, 2026

    Update dependency io.swagger.core.v3:swagger-core-jakarta to v2.2.55 …

    f5f4ff4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    backlog

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402792 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.