XmlSchemaClassGenerator icon indicating copy to clipboard operation
XmlSchemaClassGenerator copied to clipboard

Comments added to the documentation

Open M-Zuber opened this issue 10 years ago • 4 comments

It would nice if there was a way to have comments like these:

<xs:attribute name="Created" type="xs:dateTime">
<xs:annotation>
<xs:documentation>Date/time the request was created.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="ID" type="xs:string">
<xs:annotation>
<xs:documentation>
Identifier may be provided by client application for internal use/diagnostics.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<!--
 ATTRIBUTE DETAILS
                Created: When the Report request was created using format "yyyy-mm-dd hh:mm:ss"
                ID: Identifier of the request as assigned by the requesting service for internal use.

-->
</xs:complexType>

or these

<!--

 EISSN is not an "official" identifier type, but included for backward compatibility. Use Online_ISSN 
-->
<xsd:enumeration value="EISSN"/>

included in the documentation of the generated code

M-Zuber avatar Mar 22 '15 15:03 M-Zuber

Good suggestion, but AFAICT the XML comments are not carried through to the XmlSchema objects we're using to model the schemas. Do you know a way to preserve the XML comments?

The documentation annotations in your first example are already used to build code comments.

mganss avatar Mar 23 '15 11:03 mganss

I was referring only to the actual comments.

<!--
 ATTRIBUTE DETAILS
                Created: When the Report request was created using format "yyyy-mm-dd hh:mm:ss"
                ID: Identifier of the request as assigned by the requesting service for internal use.

-->

the rest was just to try and give context.

I would love to try doing it myself, but don't have enough time right now to get into your code, so I am leaving two links here that should be useful in understanding how to parse comments into c#. Of course the hard part is guessing what element they belong to :wink:

Maybe it could be based on a parameter passed in that lets the user decide if they want comments to be parsed?

http://stackoverflow.com/questions/6277966/reading-xml-comments-in-c-sharp http://stackoverflow.com/questions/20481741/c-sharp-reading-xml-comment-using-xdocument

M-Zuber avatar Mar 23 '15 12:03 M-Zuber

Hello! you can put commets in addition to summary ///

/// to attribute [Description("Some descritptiom")] wich is awailable at run-time. And I need it feature.

andrewkip avatar Sep 09 '18 08:09 andrewkip

@andrewkip Good idea. I've opened #81 to track this.

mganss avatar Sep 09 '18 11:09 mganss