OpenAPITools / OpenAPITools/openapi-generator
[BUG] [dart-dio-next] Custom Date type has no replace method
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Description
In yaml definition I have a class with a property like this:
absentFrom:
$ref: '#/definitions/Date'
and below is Date definition as
Date:
type: object
required:
- year
- month
- day
properties:
year:
type: integer
format: int32
month:
type: integer
format: int32
day:
type: integer
format: int32
Generator creates code that relies on autogenerated Date type's replace method which does not exist.
case r'absentFrom':
final valueDes = serializers.deserialize(value,
specifiedType: const FullType(Date)) as Date;
result.absentFrom.replace(valueDes);
break;
The problem is that there is no replace method on dart's Date type, at least so it seems.
openapi-generator version
5.2.1, 6.0.0
OpenAPI declaration file content or url
Full model
SchoolAbsenceDay:
type: object
required:
- year
- month
- day
properties:
year:
type: integer
format: int32
month:
type: integer
format: int32
day:
type: integer
format: int32
absentFrom:
$ref: '#/definitions/Date'
absentTo:
$ref: '#/definitions/Date'
schoolType:
type: string
school:
type: string
personType:
type: string
personClass:
type: string
reason:
type: string
Date:
type: object
required:
- year
- month
- day
properties:
year:
type: integer
format: int32
month:
type: integer
format: int32
day:
type: integer
format: int32
Generation Details
˙... -g dart-dio-next -c open-generator-config.yaml --enable-post-process-file
dart-dio yields same result
Steps to reproduce
Generate dart-dio-next code from
Suggest a fix
Deserialization should create a new Date instance instead of using replace method.
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
Reproduce the issue with the supplied OpenAPI definitions using the dart-dio-next generator command, then inspect the generated Dart deserialization for SchoolAbsenceDay and the custom Date model. Confirm the generated code does not call a missing replace method and that the resulting client code compiles and handles the Date reference correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart, openapi
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100