OpenAPITools / OpenAPITools/openapi-generator
[BUG][dart-dio] Generates call to non-existant .replace method
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- [] Have you validated the input using an OpenAPI validator (example)?
- That seems like an potentially dangerous, outdated link ^
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
dart_dio Generates code that doesn't compile. Assuming you did the steps below to generate the dart library:
- Some imports are missing, I assume this is tracked in #19144
- in
src/model/resource.dartnon-compiling code without clear semantics is generated. Here is a simplified version of whats generated:
ResourceBuilder result = ...;
JsonObject valueDes = ...;
result.path.replace(valueDes);
.pathis an optional attribute, calling a method unconditionally is no valid dart.pathis of typeJsonObjectand notResourceBuilderso there is no.replacemethod defined
openapi-generator version
OpenAPI Generator 7
OpenAPI declaration file content or url
Generation Details
java -jar openapi-generator-cli-7.7.0.jar generate -g dart-dio -i /home/derdilla/co24it/dart_aas/Plattform_i40-AssetAdministrationShellRepositoryServiceSpecification-V3.0_SSP-001-resolved.yaml -o /home/derdilla/co24it/dart_aas_gen --additional-properties=pubLibrary=dart_aas,pubVersion=1.0.0,serializationLibrary=built_value,finalProperties=false
Steps to reproduce
- run the generator
- open
src/model/resource.dart
Related issues/PRs
Suggest a fix
Without deeper knowledge of how OpenApi generator works, this seems like an incorrect or outdated template.
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
Run the listed OpenAPI Generator 7.7.0 command with the referenced declaration, then inspect the generated src/model/resource.dart. Trace the generated result.path.replace(valueDes) expression and determine the generator source responsible for it. Done means the dart-dio output compiles without the invalid optional access or nonexistent replace call.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart
- Domain
- api, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100