OpenAPITools / OpenAPITools/openapi-generator

[REQ] [rust-axum] Implement some Proptesting Scheme for the Models behind a feature

Open
#22,093 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement: Feature
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

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

When building a web application I would like to do some proptesting, or more generally just generate a few sample objects to test stuff with. For now this is pretty tedious, since I cannot implement (i.e.) quickcheck::Arbitrary and Shrink for any of the models. This would have to be done in the generated openapi crate. Instead I have to implement newtypes for every single object, essentially recreating the generated models from scratch.

Describe the solution you'd like

What I would like to see is a proptest feature that enables arbitrary/shrink implementations for the models. Whether one would rely on quickcheck or proptest or another solution is secondary.

Describe alternatives you've considered

What I also thought one could do is break out the model definitions into its own crate that could be versioned (and modified by me) with a lesser footprint. However I think the proptesting use case is common enough that this could be it's own feature.

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 by locating the rust-axum generator templates and the generated model definitions. Check how feature flags and model traits are currently emitted, then review existing Rust generator tests before deciding how a proptest-related feature should cover arbitrary and shrink behavior. Done means the feature can generate usable model implementations without requiring newtypes.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.