Expand C# object to override property name in XML documentation









up vote
0
down vote

favorite












I'm currently building and endpoint (lets call it myendpoint) and would like to be able to manipulate the parameter names to match requirements. Lets say that I have an object called myobject that contains the following properties name, address, addressCity, and addressState. However, I need addressCity and addressState to show up in the documentation as address-city and address-state. Is there a way to override the names of the properties inside the object to accomplish this?



public class myobject

public string name get; set;

public string address get; set;

[JsonProperty("address-city")]
public string addressCity get; set;

[JsonProperty("address-state")]
public string addressState get; set;


/// <summary>
/// Gets some information
/// </summary>
/// <param name="myobject"></param>
/// <returns></returns>
public IHttpActionResult GetInformation([FromURI] Object myobject)

// Code



Current documentation on the help page shows up as:
http://localhost:9999/api/myendpoint?name=name&address=address&addressCity=addressCity&addressState=addressState



I would like it to show up as:
http://localhost:9999/api/myendpoint?name=name&address=address&address-city=address-city&address-state=address-state



I have tried to use multiple attributes such as DisplayName, JsonProperty (currently using this but the XML documentation does not pickup on the new name).



Edit: Added function










share|improve this question























  • Where is the reference to the mentioned variables in the added function?
    – albert
    Nov 9 at 9:10










  • I'm sorry what are you asking for?
    – toClean
    Nov 9 at 23:24










  • You mention in your description a.o. address-state and addressState but in your code snippet none of these words are present,at least I don't see them. These are apparently part of myobject but I don't see any documentation about it.
    – albert
    Nov 10 at 9:21










  • @albert I mentioned that they are apart of myobject, but I just wrote the class out as an edit.
    – toClean
    Nov 12 at 17:50















up vote
0
down vote

favorite












I'm currently building and endpoint (lets call it myendpoint) and would like to be able to manipulate the parameter names to match requirements. Lets say that I have an object called myobject that contains the following properties name, address, addressCity, and addressState. However, I need addressCity and addressState to show up in the documentation as address-city and address-state. Is there a way to override the names of the properties inside the object to accomplish this?



public class myobject

public string name get; set;

public string address get; set;

[JsonProperty("address-city")]
public string addressCity get; set;

[JsonProperty("address-state")]
public string addressState get; set;


/// <summary>
/// Gets some information
/// </summary>
/// <param name="myobject"></param>
/// <returns></returns>
public IHttpActionResult GetInformation([FromURI] Object myobject)

// Code



Current documentation on the help page shows up as:
http://localhost:9999/api/myendpoint?name=name&address=address&addressCity=addressCity&addressState=addressState



I would like it to show up as:
http://localhost:9999/api/myendpoint?name=name&address=address&address-city=address-city&address-state=address-state



I have tried to use multiple attributes such as DisplayName, JsonProperty (currently using this but the XML documentation does not pickup on the new name).



Edit: Added function










share|improve this question























  • Where is the reference to the mentioned variables in the added function?
    – albert
    Nov 9 at 9:10










  • I'm sorry what are you asking for?
    – toClean
    Nov 9 at 23:24










  • You mention in your description a.o. address-state and addressState but in your code snippet none of these words are present,at least I don't see them. These are apparently part of myobject but I don't see any documentation about it.
    – albert
    Nov 10 at 9:21










  • @albert I mentioned that they are apart of myobject, but I just wrote the class out as an edit.
    – toClean
    Nov 12 at 17:50













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I'm currently building and endpoint (lets call it myendpoint) and would like to be able to manipulate the parameter names to match requirements. Lets say that I have an object called myobject that contains the following properties name, address, addressCity, and addressState. However, I need addressCity and addressState to show up in the documentation as address-city and address-state. Is there a way to override the names of the properties inside the object to accomplish this?



public class myobject

public string name get; set;

public string address get; set;

[JsonProperty("address-city")]
public string addressCity get; set;

[JsonProperty("address-state")]
public string addressState get; set;


/// <summary>
/// Gets some information
/// </summary>
/// <param name="myobject"></param>
/// <returns></returns>
public IHttpActionResult GetInformation([FromURI] Object myobject)

// Code



Current documentation on the help page shows up as:
http://localhost:9999/api/myendpoint?name=name&address=address&addressCity=addressCity&addressState=addressState



I would like it to show up as:
http://localhost:9999/api/myendpoint?name=name&address=address&address-city=address-city&address-state=address-state



I have tried to use multiple attributes such as DisplayName, JsonProperty (currently using this but the XML documentation does not pickup on the new name).



Edit: Added function










share|improve this question















I'm currently building and endpoint (lets call it myendpoint) and would like to be able to manipulate the parameter names to match requirements. Lets say that I have an object called myobject that contains the following properties name, address, addressCity, and addressState. However, I need addressCity and addressState to show up in the documentation as address-city and address-state. Is there a way to override the names of the properties inside the object to accomplish this?



public class myobject

public string name get; set;

public string address get; set;

[JsonProperty("address-city")]
public string addressCity get; set;

[JsonProperty("address-state")]
public string addressState get; set;


/// <summary>
/// Gets some information
/// </summary>
/// <param name="myobject"></param>
/// <returns></returns>
public IHttpActionResult GetInformation([FromURI] Object myobject)

// Code



Current documentation on the help page shows up as:
http://localhost:9999/api/myendpoint?name=name&address=address&addressCity=addressCity&addressState=addressState



I would like it to show up as:
http://localhost:9999/api/myendpoint?name=name&address=address&address-city=address-city&address-state=address-state



I have tried to use multiple attributes such as DisplayName, JsonProperty (currently using this but the XML documentation does not pickup on the new name).



Edit: Added function







c# xml api documentation






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 12 at 17:52

























asked Nov 8 at 18:17









toClean

87




87











  • Where is the reference to the mentioned variables in the added function?
    – albert
    Nov 9 at 9:10










  • I'm sorry what are you asking for?
    – toClean
    Nov 9 at 23:24










  • You mention in your description a.o. address-state and addressState but in your code snippet none of these words are present,at least I don't see them. These are apparently part of myobject but I don't see any documentation about it.
    – albert
    Nov 10 at 9:21










  • @albert I mentioned that they are apart of myobject, but I just wrote the class out as an edit.
    – toClean
    Nov 12 at 17:50

















  • Where is the reference to the mentioned variables in the added function?
    – albert
    Nov 9 at 9:10










  • I'm sorry what are you asking for?
    – toClean
    Nov 9 at 23:24










  • You mention in your description a.o. address-state and addressState but in your code snippet none of these words are present,at least I don't see them. These are apparently part of myobject but I don't see any documentation about it.
    – albert
    Nov 10 at 9:21










  • @albert I mentioned that they are apart of myobject, but I just wrote the class out as an edit.
    – toClean
    Nov 12 at 17:50
















Where is the reference to the mentioned variables in the added function?
– albert
Nov 9 at 9:10




Where is the reference to the mentioned variables in the added function?
– albert
Nov 9 at 9:10












I'm sorry what are you asking for?
– toClean
Nov 9 at 23:24




I'm sorry what are you asking for?
– toClean
Nov 9 at 23:24












You mention in your description a.o. address-state and addressState but in your code snippet none of these words are present,at least I don't see them. These are apparently part of myobject but I don't see any documentation about it.
– albert
Nov 10 at 9:21




You mention in your description a.o. address-state and addressState but in your code snippet none of these words are present,at least I don't see them. These are apparently part of myobject but I don't see any documentation about it.
– albert
Nov 10 at 9:21












@albert I mentioned that they are apart of myobject, but I just wrote the class out as an edit.
– toClean
Nov 12 at 17:50





@albert I mentioned that they are apart of myobject, but I just wrote the class out as an edit.
– toClean
Nov 12 at 17:50


















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53213846%2fexpand-c-sharp-object-to-override-property-name-in-xml-documentation%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53213846%2fexpand-c-sharp-object-to-override-property-name-in-xml-documentation%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Use pre created SQLite database for Android project in kotlin

Darth Vader #20

Ondo