swagger-api / swagger-api/swagger-codegen

[qt] Improve validation

Open
#7,833 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Client: C++ General: Suggestion
Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

Validation is missing in Qt client.

Swagger-codegen version

HEAD

Swagger declaration file content or url

https://github.com/swagger-api/swagger-codegen/blob/master/modules/swagger-codegen/src/test/resources/2_0/petstore.yaml

Command line used for generation
$ swagger-codegen generate -i ../api.yml -l qt5cpp
Steps to reproduce
  • Generate client
  • Instance Pet object without setting the name
  • See neither compilation nor execution error
Related issues/PRs

I discovered this issue after raising #7802

Suggest a fix/enhancement

A first step would be to add required parameter to the model constructor.

A second step would be to avoid property setter with pointer and add unsetter for optionnal field.

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 the petstore.yaml declaration and generate the qt5cpp client using the command shown. Inspect the generated Pet model and its handling of the required name field, then compare behavior for required and optional properties. Done means required fields are enforced at construction and optional fields support the requested setter and unsetter behavior.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.