microsoft / kiota

OpenAPI based HTTP Client code generator
https://aka.ms/kiota/docs
MIT License
3k stars 210 forks source link

Dart support #3745

Open rodion-m opened 1 year ago

rodion-m commented 1 year ago

Do you plan to add Dart client generation support to make it compiable with Flutter?

And thanks for a great tool!

### Tasks
baywet commented 1 year ago

Hi @rodion-m Thanks for using kiota and for reaching out. We (Microsoft) don't have plans to add Dart at this point. But we'd be happy to support the community in doing so. For the details, you can look at #2199 Let us know if you have further questions.

ricardoboss commented 9 months ago

@baywet Are there docs how to add support for new languages by now? Dart would be a great addition and I'd like to play around with kiota.

baywet commented 9 months ago

@ricardoboss We don't have public documentation for this today. here is an answer where I outlined the high level approach to implementing a new language support.

ricardoboss commented 9 months ago

Hey @baywet, can I get your input on my attempt to implement the interfaces you mentioned?

https://github.com/ricardoboss/dart_kiota_abstractions

Would this be enough to start working on a generator?

baywet commented 9 months ago

You've made great progress! How do you want me to funnel the feedback? issues in that repo? Also, I don't know anything about dart, so there might be subtilities about the language I might miss (pointers, nullability, reference vs value copy, etc...) Lastly, I'm not sure how you get a dart package published, but can you make sure this doesn't get published? or at least if it does, that it doesn't take any official "Microsoft owned" placeholder?

ricardoboss commented 9 months ago

Thanks! Feedback in the form of issues in that repo is fine. I don't know any Dart specialists personally, but maybe someone viewing this issue wants to chime in and leave some feedback :)

Package publishing is done on pub.dev. Dart packages don't have namespaces, but there are verified publishers. If you want to know more, I suggest you look here: https://dart.dev/tools/pub/publishing

The package in its current form cannot be published. This is because of the publish_to: 'none' line in the pubspec.yaml.

Edit: of course I am willing to provide help and information where needed!

Edit 2: If I publish the package now (as a prerelease for example) it is still possible to transfer the package over to a Microsoft-owned publisher later on (I'm thinking of https://pub.dev/publishers/microsoft.com).

Edit 3: As it turns out, I would have to be a member of the publisher to transfer the package. So its best to use a different name or just don't publish it at all.

baywet commented 9 months ago

You've done some great work there! I created a couple of issues. Once we start seeing the generation pull requests coming in, we might re-home the repository under the microsoft organization if you don't mind? Also another thing to consider, in some languages (most in fact) it's more convenient to use a monorepo for all the kiota libraries, like we've done for TypeScript/Java (and probably should have done for dotnet as well in retrospective). The main consideration here are about the publishing workflow: how easy is it to have all packages use the same single version? and publish them all at once using the same workflow without it having a bunch of complicated steps/conditions/etc...

ricardoboss commented 9 months ago

Once we start seeing the generation pull requests coming in, we might re-home the repository under the microsoft organization if you don't mind?

Fine by me.

The main consideration here are about the publishing workflow: how easy is it to have all packages use the same single version?

It is doable. Take a look at how its done in this repo: https://github.com/std-uritemplate/std-uritemplate The release workflow specifically.

baywet commented 9 months ago

I meant grouping the dart dependencies (abstractions, json, http,...) on the same repo. Not grouping the same type of dependency across languages (all abstractions for example) on the same repo.

ricardoboss commented 9 months ago

Oh sorry. Yeah that is also possible quite easily. The Flutter team uses a monorepo approach for their own packages: https://github.com/flutter/packages/tree/main/packages

JohnGalt1717 commented 1 month ago

Is there any movement on this? Flutter is VERY common especially in enterprise for creating cross platform apps. It would be VERY beneficial to have Dart support for this reason.

ricardoboss commented 1 month ago

@JohnGalt1717 there is movement! A few colleagues from https://topicus.nl/ and me are actively working on implementations and code generation. I can't give an estimate when this can go into preview but it's being worked on.

If you want to check the current state of development, please go to: https://github.com/kiota-community/dart_kiota and https://github.com/microsoft/kiota/compare/main...kiota-community:kiota-dart:features/dart

JohnGalt1717 commented 1 month ago

Awesome!!!! Can't wait! (this and enums with key/value will make this project absolutely rock)