autorest icon indicating copy to clipboard operation
autorest copied to clipboard

Missing documentation for CSharp code generator

Open brnleehng opened this issue 10 years ago • 11 comments

The documentation for the CSharp generator seems to be missing some comments that would be nice to see.

  1. ~~#288~~
  2. #289
  3. ~~<remarks> comments~~
  4. Able to specify <exception> comments such as the AutoRest validation exception.
  5. ~~Prefix 'gets or sets' in the comments based on the properties settings such as isReadOnly~~
  • We've noticed that the other teams have 'gets or sets' in their descriptions for definitions since the 'gets or sets' comment is not being set in the model template. This will be an issue when they are generating other clients. Since the comment will not make any sense in the python client for example.

I have a fix for 5, found where the 'get or sets' prefix is generated in the model template and added this check. @:/// <summary> @:@WrapComment("/// ", property.IsReadOnly ? "Gets " + property.Documentation.EscapeXmlComment() : "Gets or sets " + property.Documentation.EscapeXmlComment()) @:/// </summary>

brnleehng avatar Apr 26 '16 20:04 brnleehng

This duplicates some issues that I opened quite a while ago:

https://github.com/Azure/autorest/issues/288 https://github.com/Azure/autorest/issues/289

I agree, it would be great to see these fixed. :)

bitsforthought avatar Apr 26 '16 20:04 bitsforthought

@brnleehng We should remove your (1) and (2) and just edit this to refer to the issues opened by @brjohnstmsft there instead. I think your (3), (4), and (5) still apply.

matthchr avatar Apr 26 '16 23:04 matthchr

@tbombach @markcowl @hovsepm @brjohnstmsft I am working on solving number 3 above.

Are you okay with the following? On operations: "summary" maps to <summary> (it already does this actually, just including it for completeness)

On models: "title" maps to <summary>, and if "title" is not specified, then "description" gets promoted to <summary> instead, to avoid breaking existing client documentation patterns which have "description" being used as the <summary> tag everywhere.

matthchr avatar Jun 11 '16 01:06 matthchr

Alright, see: #1163 for fix to item 3 (support of remarks)

matthchr avatar Jun 14 '16 01:06 matthchr

Items 3 and 5 are now fixed. I believe @brjohnstmsft also has fixed item 2 for CSharp

matthchr avatar Jun 16 '16 21:06 matthchr

I fixed item 1, not item 2.

bitsforthought avatar Jun 16 '16 21:06 bitsforthought

Just looping around on issues that we wanted to get cleaned up.

@brjohnstmsft Kinda curious what you were thinking with 4 - ' Able to specify comments such as the AutoRest validation exception. '

You wanted to be able to put text in the swagger for what shows up in <exception>...</exception> ?

That's kinda specific to c# -- and if that's the case, we're going to have to wait on that for some work we're looking into for per-language-specific settings so we can keep swagger clean.

fearthecowboy avatar Oct 28 '16 18:10 fearthecowboy

@fearthecowboy That proposal was from @brnleehng, not me

bitsforthought avatar Oct 28 '16 21:10 bitsforthought

@brnleehng Was probably just proxying me on that one =P

The intent is as follows:

  1. We know that we raise certain validation exceptions, so we should include those in a <exception> (in C#) or a raises in Python probably.
  2. This also applies to custom exception types defined in the default category -- AutoRest knows that a particular operations default throws a BatchErrorException, then it might as well put that in the <exception> or rasies section.

Note: Other languages probably have their equivilant of raises/<exception> too.

matthchr avatar Oct 28 '16 22:10 matthchr

IIRC, we do spit out <execption>s now.

fearthecowboy avatar Nov 08 '16 23:11 fearthecowboy

@fearthecowboy -- Long time coming but just wanted to confirm that you do indeed output the exception details now. Thanks!

It looks like the only remaining issue here is 2, which is also being tracked here: #289, so I think you can close this issue now.

matthchr avatar Apr 18 '17 22:04 matthchr