swagger-api / swagger-api/swagger-parser

Parser fails when no default value defined

Open
#429 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
867
Forks
560
Avg merge
2d 21h
Merged PRs (30d)
7

Description

Hi,

I was parsing a json with 1.0.10 version and everything worked well, but when I updated to 1.0.28 because I need vendor extensions to get parsed, I get an error because of setting a default value with null. I don't have default values and client don't want to writte them. Debug says is at io.swagger.parser.util.SwaggerDeserializer.parameter(SwaggerDeserializer.java:481)

sp.setDefault(defaultValue);

Any clue?

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 at io.swagger.parser.util.SwaggerDeserializer.java:481 and inspect how parameter parsing handles a missing default value before sp.setDefault(defaultValue). Reproduce with a JSON definition that has no default values, then verify that parsing succeeds and vendor extensions are still parsed without the null-default error.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.