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

URL templating support #628

Closed
5 of 6 tasks
Tracked by #1049
baywet opened this issue Sep 15, 2021 · 4 comments · Fixed by #683
Closed
5 of 6 tasks
Tracked by #1049

URL templating support #628

baywet opened this issue Sep 15, 2021 · 4 comments · Fixed by #683
Assignees
Labels
Csharp Pull requests that update .net code fixed generator Issues or improvements relater to generation capabilities. Go Java Ruby TypeScript Pull requests that update Javascript code

Comments

@baywet
Copy link
Member

baywet commented Sep 15, 2021

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:

  • The current Path property needs to be renamed to Uri template and contain the full URI + an expansion of any query parameter
  • An additional dictionary/map of currentUriTemplateValues property needs to be added to request builders, and request builders constructors
  • Code writers for each language need to be updated to account for those changes, and pass the current values instead of the current path
  • Code indexers/navigation methods (path parameters) need to add the additional parameters to the map before passing it to the next request builder
  • The request information needs a setter method for the URI that takes in a template and the parameters and resolves to as URI
  • once changes are made in other languages check the progress on PHP Generation #664 and either rebase to implement changes in PHP or create a separate issue for it.
    AB#11152
@baywet baywet added Csharp Pull requests that update .net code TypeScript Pull requests that update Javascript code Go Ruby Java generator Issues or improvements relater to generation capabilities. labels Sep 15, 2021
@baywet baywet added this to the Beta milestone Sep 15, 2021
@baywet baywet self-assigned this Sep 15, 2021
@baywet
Copy link
Member Author

baywet commented Sep 17, 2021

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

@baywet

This comment has been minimized.

@baywet
Copy link
Member Author

baywet commented Oct 4, 2021

Suggested libraries

@baywet baywet linked a pull request Oct 5, 2021 that will close this issue
@baywet
Copy link
Member Author

baywet commented Oct 6, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Csharp Pull requests that update .net code fixed generator Issues or improvements relater to generation capabilities. Go Java Ruby TypeScript Pull requests that update Javascript code
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants