Skip to content
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

Swashbuckle rename Data Type in Model #457

Closed
weretac0 opened this issue Aug 14, 2015 · 2 comments
Closed

Swashbuckle rename Data Type in Model #457

weretac0 opened this issue Aug 14, 2015 · 2 comments
Milestone

Comments

@weretac0
Copy link

I'm putting together a web API that needs to match an external sources XML format and was looking to rename the Data Type objects in the swagger output.

It's working fine on the members of the class but I was wondering if it was possible to override the class name as well.

Example:

[DataContract(Name="OVERRIDECLASSNAME")]
public class TestItem
{
   [DataMember(Name="OVERRIDETHIS")]
   public string toOverride {get; set;}
}

In the generated output I end up seeing Model:

TestItem {
    OVERRIDETHIS (string, optional)
}

I'd hope to see

OVERRIDECLASSNAME 
{ 
    OVERRIDETHIS (string, optional) 
}

Is this possible?

Thanks,

@domaindrivendev
Copy link
Owner

In the next milestone release - 5.2.2, it will be possible to provide a custom strategy for determining Schema Id's for complex Types. With this in place, you'll be easily able to wire up a strategy that inspects Types for the presence of the DataContract attribute ...

c.SchemaId(Func<Type, string> schemaIdStrategy)

@domaindrivendev
Copy link
Owner

See v5.2.2

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

No branches or pull requests

2 participants