-
Notifications
You must be signed in to change notification settings - Fork 738
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
CSharp: add support for excluding models from a proxy by referencing … #1043
Conversation
Can one of the admins verify this patch? |
Hi @jhancock93, I'm your friendly neighborhood Azure Pull Request Bot (You can call me AZPRBOT). Thanks for your contribution! TTYL, AZPRBOT; |
This is some what related to issue #642 but is a different way of dealing with external types, more along the lines of how the WCF svcutil allowed types to be referenced from external assemblies. |
Can one of the admins verify this patch? |
d0f80dd
to
dd3ad8c
Compare
Rebased pull request to more recent version of master to avoid merge conflicts. |
I have one test that I added that passes on Windows but is failing when run by Travis. Any suggestions on how to reproduce the issue locally? |
@azuresdkci test this please! |
I see there are now changes that require conflicts to be merged. I can rebase this branch on top of master again and fix the conflicts. Will one of the admins please respond as to whether I should go ahead and do that? This PR has been sitting idle for 2 weeks... |
@jhancock93 I'll take a look at this today and leave any comments if there are any necessary changes before you have to rebase. |
@@ -60,3 +60,4 @@ | |||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1002:DoNotExposeGenericLists", Scope = "member", Target = "Microsoft.Rest.Generator.ClientModel.ServiceClient.#Methods")] | |||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1002:DoNotExposeGenericLists", Scope = "member", Target = "Microsoft.Rest.Generator.ClientModel.ServiceClient.#Properties")] | |||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1002:DoNotExposeGenericLists", Scope = "member", Target = "Microsoft.Rest.Generator.ClientModel.ParameterTransformation.#ParameterMappings")] | |||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Scope = "member", Target = "Microsoft.Rest.Generator.Settings.#Create(System.Collections.Generic.IDictionary`2<System.String,System.Object>)")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you need this suppression anymore, since you removed the try/catch from an earlier commit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! I have removed this line.
80890bf
to
6934e6d
Compare
Rebased on latest master and addressed code review comments. |
6934e6d
to
ee9ac27
Compare
@azuresdkci retest this please |
I don't understand what might cause the "No test results found" error in the "default" check. Is there something I need to do from my end to fix the problem? |
Howdy, @jhancock93 -- We've been discussing this PR in our internal standup. I really like the parts about using a response-file on the command line for pulling in the settings. If you give me a PR with that separately, we'll take that right away. We're mulling over how we want to handle skipping code-gen of referenced classes. Currently you can mark a type as I've also got some ideas swirling around on how to do some declarations a bit more generically so we can apply the same pattern against multiple language generators. Is there a something that |
Thanks for taking a look at this PR. [UPDATE]: I have separated out the piece for using a JSON file to supply code gen settings on the command line and created PR #1147. Referencing external types is a complex issue, so I'm glad to have a discussion about it. I was aiming for functionality along the lines of what SvcUtil provides for WCF services. It provides similar functionality to exclude types from a proxy based on what it finds in a externally referenced DLL. I have a team that is transitioning a bunch of services from SOAP to WebAPI, so it was convenient to be able to reference the same contract assemblies for SOAP proxies generated by SvcUtil and WebAPI proxies generated by AutoRest. Before I implemented my changes, I looked at the x-ms-external tag and there were a few issues with it that I could see:
|
IIRC, yeah, that's on my list of things to fix.
That was one of my assumptions, glad to see it validated.
Currently true, but I'm thinking of a way to allow you to specify that tangential to the swagger itself.
And that's my other assumption validated. Again, I am thinking about a different workaround that would get us past the need to embed it in the swagger, but ... you're right, if the namespace isn't the same as the expected namespace, it's not going to find it... Lemme get back to you. |
…external assembly - Change CustomSettings to be dictionary of object to allow for array items - Change CSharpGenerator to be able to reference external assemblies and namespaces when assembly is passed in on commandline (like WCF svcutil).
ee9ac27
to
8dc2940
Compare
Directory separator was wrong. Changed to use Path.Combine
Any more discussion on this topic? I see that the team is currently working to reorganize the folder structure in the repo... |
@fearthecowboy and @tbombach can we get a thumbs up or down on this functionality prior to pulling in #1220? |
This will need to be refactored to work in the new code base (going into a branch Fixing externals is something that's definitely in my short term planning. |
…external assembly
namespaces when assembly is passed in on commandline (like WCF svcutil). Namespaces of the matching types are automatically referenced in the proxy so the proxy does not need to be hand-edited.