swagger-api / swagger-api/swagger-codegen
[pistache-server]: does not generate required object fields
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
When generating pistache-server code, non-primitive, non-string, non-datetime objects that are marked as required are not taken into account when generating with the fromJson method.
Swagger-codegen version
Latest release
Swagger declaration file content or url
Refer to pet documentation example, line #150
https://github.com/swagger-api/swagger-codegen/blob/master/samples/yaml/pet.yml#L150
If you add category to the required fields, this bug should appear in the pistache-server generation.
Command line used for generation
docker run --rm -v ${PWD}:/local -u $(id -u):$(id -g)
swaggerapi/swagger-codegen-cli generate
-i /local/crs_api_spec.yaml
-l pistache-server
-o /local/generated
Steps to reproduce
Generate a non-primitive, non-string, non-datetime object within an object, and mark it as a required field.
Serialize object and deserialize object from json.
Observe different JSON.
Related issues/PRs
Hopefully, this is fixed in #10228 but have not FULLY confirmed due to maven build locally failing with over 100 tests unrelated to the mustache change I made.
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 the pistache-server generation path and the fromJson method, using the pet.yml example at line 150 to reproduce the required category case. Compare the serialized and deserialized JSON for a required nested object, and review related PR #10228 and its Mustache change before deciding whether the issue remains. Done means required non-primitive fields are preserved through deserialization.
Written by the indexing model from the issue text.
Assessment
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100