-
-
Notifications
You must be signed in to change notification settings - Fork 7.1k
[typescript-fetch] oneOf models now consider primitives when converting #21464
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@DavidGrath can you resolve the merge conflict? |
@macjohnny, yes, please give me till early Saturday or sooner |
@macjohnny, resolved |
@macjohnny thank you |
@DavidGrath thank you for the fix! |
@DavidGrath there was one other thing I noticed about the serialization / deserialization code which I thought I would check with you about. Does it make sense to distinguish between In the sample OAS you provided for the bug two of the - type: string
format: date
- type: string
format: date-time Which results in this code in the deserialization method (which is fine but the second // is getTime supposed to distinguish between `isDateType` & `isDateTimeType`?
if (!(isNaN(new Date(json).getTime()))) {
return json == null ? undefined : (new Date(json));
}
if (!(isNaN(new Date(json).getTime()))) {
return json == null ? undefined : (new Date(json));
} But the serialization method might cause an issue: if (value instanceof Date) {
return ((value).toISOString().substring(0,10));
}
if (value instanceof Date) {
return value == null ? undefined : ((value).toISOString());
} Since the If we reverse the checks for Does that seem reasonable to you? |
@btpnlsl , sorry for the delayed response. You're right. I mainly copied and modified the date and time logic from somewhere else and so I didn't think too deeply about the need to distinguish between the two or the need for extra precision. I think if I make another PR for a separate issue, I can include this improvement as well |
PR checklist
Commit all changed files.
This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master.
These must match the expectations made by your contribution.
You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example
./bin/generate-samples.sh bin/configs/java*
.IMPORTANT: Do NOT purge/delete any folders/files (e.g. tests) when regenerating the samples as manually written tests may be removed.
master
(upcoming7.x.0
minor release - breaking changes with fallbacks),8.0.x
(breaking changes without fallbacks)The output looks like this:
@joscha @macjohnny , please help review for TypeScript