swagger-api / swagger-api/swagger-core
BUG Unable to deserialize OpenAPI Parameter
Nobody has claimed this yet.
- 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$StyleEnumfrom 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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