Open Yavor81 opened 7 years ago
ExcludedTypeNames only works for DTO classes, are you trying to exclude a client class?
Te endpoint receives IFormFile as an input parameter. My generated client should be able to pass such objects. The problem is that the generator generates another type named 'FileParameter', which is something I want to prevent. I just want to preserve the IFormFile type to be references in the generated client.
Actually, what I need is a form data generator for CSharp to be able to generate upload file method in the client.
Can you post a sample controller?
In general, what I want is to prevent NSwag from generating class for existing types. For example: Telerik Kendo UI has couple of types for support paging and sorting. The input class is DataSourceRequest and the result class is DataSourceResult. Currently, NSwag generates client classes that are similar to these two. I have to create map methods between the two which is a cumbersome and error prone process. My idea is if NSwag can re-use the existing types by specifying the fully qualified name of the class for example. Is this possible now?
You can exclude the types with ExcludedTypeNames and add usings with AdditionalNamespaceUsages
@YavorTelerik @RSuter Hello, I am facing the same issue with objects related to DataSource. Did you find a solution around with NSWAG?
Thanks
Isnt ExcludedTypeNames working for you?
Hi @RSuter I posted this before you told me about the ignore attribute. Now, i am ignoring those methods that make use of the Telerik complex objects and extending the generated class with methods specific for those Telerik objects, etc.
Thanks
Hi @RSuter i want to only exclude the "base class" in the model list of swagger ui.
For example i have a base type of
public abstract class BaseEntity
{
public BaseEntity()
{
CreatedTS = DateTime.Now;
UpdatedTS = DateTime.Now;
}
public int Id { get; set; }
public DateTime CreatedTS { get; set; }
public string CreatedBy { get; set; }
public DateTime UpdatedTS { get; set; }
public string UpdatedBy { get; set; }
}
and the deriving type is
public class FieldAgency : BaseEntity
{
public string FieldAgencyNbr { get; set; }
public string Name { get; set; }
}
In the generated model i want to see all the properties of the BaseEntity
in the derived type but i dont want the BaseEntity
in the model list.
Is this possible>
Hi, is there any solution for this yet ? I want to exclude the derived class FileParameters/FileResponse that is created due IFormFile and create my own class on another namespace
Use https://github.com/RicoSuter/NJsonSchema/blob/master/src/NJsonSchema/Annotations/JsonSchemaFlattenAttribute.cs to hide/merge base class
ExcludedTypeNames only works for DTO classes, are you trying to exclude a client class?
Is there a way to ignore entire namespaces?
Hi, I want to implement file upload in a Web API endpoint that accepts IEnumerable in my ASP.NET core application.
Since this is an built-in type, how can I prevent from generating a proxy for the IFormFile. I am using NSwagStudio but the option "Excluded type names" seems not working.
I am using the C# generator.