Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #7270
Closed
Open
Issue created Aug 22, 2020 by Administrator@rootContributor

[REQ] Rust generated code should follow Clippy suggestions

Created by: UkonnRa

Is your feature request related to a problem? Please describe.

Now, when using cargo clippy to check the generated code, some bad smell may raise.

For example, when running cargo clippy --all-targets --all-features --allow-dirty --allow-staged --fix -Z unstable-options -- -D warnings, the following warning may raise:

About naming

warning: structure field `UID` should have a snake case name
  --> external\hydra-client\src\models\plugin_config_user.rs:20:9
   |
20 |     pub UID: Option<i32>,
   |         ^^^ help: convert the identifier to snake case: `uid`

About rules like new_without_default

warning: you should consider adding a `Default` implementation for `models::logout_request::LogoutRequest`
  --> external\hydra-client\src\models\logout_request.rs:28:5
   |
28 | /     pub fn new() -> LogoutRequest {
29 | |         LogoutRequest { request_url: None, rp_initiated: None, sid: None, subject: None }
30 | |     }
   | |_____^
   |
   = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#new_without_default
help: try this
   |
27 | impl Default for models::logout_request::LogoutRequest {
28 |     fn default() -> Self {
29 |         Self::new()
30 |     }
31 | }
   |

Describe the solution you'd like

More strict lint test is needed when testing the generator

Describe alternatives you've considered

No alternative

Additional context

You can test by using the following schema: https://github.com/ory/hydra/blob/master/.schema/config.schema.json

Assignee
Assign to
Time tracking