Skip to content
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

Add support for discriminator and type downcast during deserialization #648

Closed
4 tasks
Tracked by #1 ...
baywet opened this issue Sep 21, 2021 · 0 comments · Fixed by #1174
Closed
4 tasks
Tracked by #1 ...

Add support for discriminator and type downcast during deserialization #648

baywet opened this issue Sep 21, 2021 · 0 comments · Fixed by #1174
Assignees
Labels
CLI Work to support generating CLIs with Kiota Csharp Pull requests that update .net code generator Issues or improvements relater to generation capabilities. Go Java TypeScript Pull requests that update Javascript code

Comments

@baywet
Copy link
Member

baywet commented Sep 21, 2021

OpenAPI has a way to describe which property can be used as a discriminator on an object type to determine the true type of an object.
This is especially useful when receiving an mixed collection. In OData terms and taking a Microsoft Graph example we can thing of collections of directoryObjects where the values inside the result collection can be users, groups, applications and more.
The current SDKs know how to downcast the results thanks to the OData type property on each entry.
When the conversion library supports that information Kiota deserialization needs to:

  • offer a way to register discriminator handlers that would reach the value of the property, and return the target type
  • add the discrimination information to the models (static property?) during the generation process
  • read the discrimination value, pass it to the handlers
  • call the deserialization method of the target type instead
    AB#11197
@baywet baywet added Csharp Pull requests that update .net code TypeScript Pull requests that update Javascript code needs more information Python Go Ruby Java generator Issues or improvements relater to generation capabilities. labels Sep 21, 2021
@baywet baywet added this to the TypeWriter Replacement milestone Sep 21, 2021
@baywet baywet added blocked This work can't be done until an external dependent work is done. and removed needs more information labels Oct 6, 2021
@baywet baywet self-assigned this Oct 21, 2021
@baywet baywet added the CLI Work to support generating CLIs with Kiota label Nov 29, 2021
This was referenced Feb 23, 2022
@baywet baywet removed the blocked This work can't be done until an external dependent work is done. label Feb 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLI Work to support generating CLIs with Kiota Csharp Pull requests that update .net code generator Issues or improvements relater to generation capabilities. Go Java TypeScript Pull requests that update Javascript code
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant