Skip to content

Comments

Honor x-accessibility on operations#1145

Merged
chamons merged 11 commits intoAzure:feature/v3from
chamons:llc_access
Apr 13, 2021
Merged

Honor x-accessibility on operations#1145
chamons merged 11 commits intoAzure:feature/v3from
chamons:llc_access

Conversation

@chamons
Copy link
Contributor

@chamons chamons commented Apr 12, 2021

- Fixes: Azure#1134
- Add LLC variant of TestProjects tests
@chamons chamons requested review from m-nash, pakrym and weshaggard April 12, 2021 15:27
@chamons chamons requested a review from ShivangiReja as a code owner April 12, 2021 15:27
@chamons
Copy link
Contributor Author

chamons commented Apr 12, 2021

Here is the current PR diff with no generated files - https://gist.github.com/chamons/561ebeb0f34bfc1424b3204c746d258b

@pakrym
Copy link
Contributor

pakrym commented Apr 12, 2021

Can you please add a section to the README.md about this feature?

@chamons
Copy link
Contributor Author

chamons commented Apr 12, 2021

Question @pakrym

This PR previously didn't touch RestClientWriter because I don't have test coverage (or even know if this should apply there).

I see a few options:

  • 1 - Keep the ClientMethod / RestClientMethod model to nullable and set it to null everywhere i'm not explicitly testing.
    • Advantage: I'm not mucking with code I don't have good test coverage for. Keep PR small.
    • Disadvantage: Some writers are hard coding public in places that may need to honor x-accessibility. If I miss a place we might have a null floating around.
  • 2 - Insist that all writers stop hard coding method visibility, as that should be a model concern.
    • Advantage: Architectural purity
    • Disadvantage: Either I write a bunch more tests or I'm changing behavior with no visibility.

I'm strongly leaning towards #1, but I'm not sure if that is laziness due to lack of second cup of coffee or being smart.

@pakrym
Copy link
Contributor

pakrym commented Apr 12, 2021

I'll go with # 2 and see if it changes any generated code. It should be pretty obvious if you've broken anything.

@chamons chamons marked this pull request as draft April 12, 2021 16:36
@chamons
Copy link
Contributor Author

chamons commented Apr 12, 2021

Moving to draft given size of changes likely to go in.


Request request = new Request (method.Request.HttpMethod, method.Request.PathSegments, method.Request.Query, method.Request.Headers, body);
yield return new RestClientMethod (method.Name, method.Description, method.ReturnType, request, parameters.ToArray(), method.Responses, method.HeaderModel, method.BufferResponse, method.Accessibility);
yield return new RestClientMethod (method.Name, method.Description, method.ReturnType, request, parameters.ToArray(), method.Responses, method.HeaderModel, method.BufferResponse, accessibility);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pull it off method.BufferResponse?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what you are asking here?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry. You seem to be passing accessibility both into BuildMethod and here. Why both?

Copy link
Contributor Author

@chamons chamons Apr 13, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're calculating the "base" method via _builder.BuildMethod and then clone it with modifications.

I think the way I'm doing it is technically correct, but just copying it over with:

yield return new RestClientMethod (method.Name, method.Description, method.ReturnType, request, parameters.ToArray(), method.Responses, method.HeaderModel, method.BufferResponse, method.Accessibility);

would be more clear.

@chamons
Copy link
Contributor Author

chamons commented Apr 13, 2021

Test failure a known issue (that i'm going to look at next) - #1152

@chamons chamons marked this pull request as ready for review April 13, 2021 17:35
@chamons chamons merged commit 7740e3c into Azure:feature/v3 Apr 13, 2021
@chamons chamons deleted the llc_access branch April 13, 2021 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[LLC] Add support for x-accessibility

2 participants