swagger-api / swagger-api/swagger-core

BUG Unable to deserialize OpenAPI Parameter

Open
#4,689 1 comment 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

I was trying to convert json string to OpenAPI object and met below error:

Cannot deserialize value of type io.swagger.v3.oas.models.parameters.Parameter$StyleEnum from String "form": not one of the values accepted for Enum class: [MATRIX, SIMPLE, SPACEDELIMITED, FORM, DEEPOBJECT, LABEL, PIPEDELIMITED]

Then I tried to run below code (captured from ParameterDeSerializationTest.java) and also failed (threw same error).
final String json = "{\"in\":\"query\",\"style\":\"form\",\"required\":false,\"schema\":{\"type\":\"string\"}}";
final Parameter p = m.readValue(json, Parameter.class);

Is this a bug?

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 ParameterDeSerializationTest.java and reproduce the reported readValue call using the JSON string in the issue. Trace how Parameter$StyleEnum handles the lowercase "form" value and compare it with the accepted enum values. Done means the deserialization behavior is understood and covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, openapi
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.