microsoft / kiota

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

URL templating support #628

Closed baywet closed 3 years ago

baywet commented 3 years ago

Recent feedback in the following issues has proven limitations in the way URLs are built via the fluent API. Kiota generated request builders are currently storing the previously built URL in a current path property, and appending the current segment (with it's parameters) to it to pass it to the next request builder and/or execute the request.

This shows shortcomings for:

We need to rework the generator, the language writers and the abstractions libraries to properly implement the query and path parameters and a proper way to do so would be to use URI templates.

Here is a high-level list of what needs to happen:

baywet commented 3 years ago

additional resources http://bizcoder.com/constructing-urls-the-easy-way

baywet commented 3 years ago

also consider https://docs.microsoft.com/en-us/dotnet/api/system.uritemplate?view=netframework-4.8

baywet commented 3 years ago

Suggested libraries

baywet commented 3 years ago

This is probably going to introduce a regression: using the request builders with raw URLs. We should probably add an overload constructor that'd accept the raw URL, set it as the only url template parameter with a special key for the request information, which would in terms set the request information raw URL.

For typescript we can use a union type (map | string) and implement this behavior as well.