OpenAPITools / OpenAPITools/openapi-generator
[dart-dio] Support `BigInt` for `"type":"string", "format":"int64"` in Dart generator
Nobody has claimed this yet.
- 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.
Currently any OpenAPI schema property declared as:
"id": {
"example": "1",
"format": "int64",
"type": "string"
}
is generated as a Dart String. This forces users to manually parse large integers themselves, even though Dart has built-in BigInt support and json_serializable can already handle BigInt encoding/decoding.
Describe the solution you’d like
Enhance the Dart generator so that fields with "type": "string", "format": "int64" map to Dart BigInt.
- In models: generate
BigInttyped fields. - In (de)serialization: use
BigInt.parse(...)and.toString(). - Optionally expose a generator flag to fall back to
Stringif desired.
Describe alternatives you’ve considered
- Post-generation script to replace all
StringwithBigIntand insert manual (de)serialization logic. - Manually converting in app code after receiving responses.
Additional context
The json_serializable package already supports BigInt via custom converters. Automating this in the generator would save repeated boilerplate and reduce runtime errors when handling very large 64-bit IDs.
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 by locating the dart-dio generator's type-mapping and model serialization entry points, then inspect how string/int64 schemas are handled. Verify the generated model fields and deserialization/serialization behavior for the example schema; done means those fields use BigInt with the requested conversions, while any fallback option is clearly defined.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, openapi
- Domain
- api, tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100