-
Notifications
You must be signed in to change notification settings - Fork 732
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
Formatting returned paging URLs #1232
Comments
As an example, the nextLink of GraphRbac is:
while the valid Url to get the page is:
|
I wrote a long breakdown of this issue, and re-stated the context to get anyone up to speed if they missed the discussion last time. I put some options at the end and recommended one, so let's talk about this during the discussion meeting tomorrow. Problem summaryThe Graph.RBAC spec has operations that return a pageable response (i.e. with Graph.RBAC service expects that a user would take the Example (thanks Laurent!):
Graph.RBAC Swagger specEach pageable operation in the spec (e.g. groups) defines an The corresponding Current behaviorThe behavior depends on if C# SDK CodeHandles paging extension by:
Python (possibly others too) Graph.RBAC SDK CodeHandles paging extension by:
WorkaroundsC# SDK CodeThe issue can be worked around in .NET by changing the logic in the generated code to append query parameters to the built URL, not set them (i.e. by starting with Options1) Mandate that nextLink must be a complete URLCons: this prevents us from supporting Graph.RBAC for the foreseeable future. 2) Add a configurable/overridable way to construct the URL in each languageCons: More functionality to support (for all language teams), wouldn't be standard across all languages, wouldn't likely be used by anyone else (since pageable is an Azure extension, and they all should be following the guidelines), would duplicate some AutoRest logic, since it would be doing the parameter replacements that generated code already does. 3) (Recommended) Standardize the paging logic for all languages so that fragment URLs can be supported by using
|
Thanks @tbombach for this write up! So just to clarify - your recommendation is that the fix for this scenario will happen purely in the individual language generators (as opposed to within the core/extension projects) and will based on the presence of the operationName field? Cheers. |
@annatisch Correct, it would be in each generator, no changes to core or extensions. I tried to think of an addition to the extension that would make it easier for each generator, but making it flexible enough for the RBAC scenario requires information that would just duplicate info that already exists in the Next operation definition (e.g. path & query parameters). I'll send out a PR that adds the specific Graph.RBAC scenario to the test server (and updates the C# generator to handle it). I wanted to give everyone a chance to comment on the proposal in today's meeting before we committed to this plan though. |
@tbombach - thanks! I have finished these changes for the Python generator. |
@annatisch Awesome! I got started on a generator test (it's in this branch: https://github.com/tbombach/autorest/tree/paging-fragment-test). I'm not sure if I'll be able to get it checked in before early next week, so feel free to use it as a starting spot if you want to finish it before then. Otherwise I'm happy to finish it and get it checked in. |
@tbombach - can you confirm which, if any, languages still need to implement support for this so we can label accordingly? |
I'm closing this issue in favor of #1426, which summarizes the issue and specifically tracks the changes that have to be made for the generators for the other languages. Hopefully that makes it easier for whoever will make the changes. |
Hi,
As raised recently in issue #1217, currently the Python generator assumes that any "nextLink" URL returned by a service will be a complete URL.
Obviously this is not the case and all (please correct me if I'm wrong) of the following may apply:
Currently none of the above scenarios are handled by Python - are we able to confirm which are/are not covered by other languages?
I started making a fix for the Python generator to handle some of these scenarios, though @xingwu1 has suggested that this would be better handled by extending the x-ms-pagable extension to include a parameter marking whether the returned URL should be considered complete or whether it requires formatting (concatenating, path parameters, query parameters) in order to be valid.
So - looking for thoughts/feedback on the current status and the best way to approach this.
If all the other languages already handle these cases, then I will continue to work on a solution specific to the Python generator.
Cheers.
The text was updated successfully, but these errors were encountered: