I have the following enum in my Model:
public enum MYENUM
{
[Display(Name = "Allgemein")]
ENUMVAL1,
[Display(Name = "Artikel")]
ENUMVAL2
}
QUESTION: Is it possible to include the Display Attribute in my generated client code?
Currently I generate my swagger-file from an webapi-dll. From the generated swagger file a c# client is generated.
At the moment this is not possible.
This would only be possible with custom extensions to the schema.
Sounds interessting... could you point me in the right direction and give some hints where to start? maybe I find the time to come up with a custom extension :)
Implement a schema processor and add it with attribute.
https://github.com/RSuter/NJsonSchema/wiki/Schema-Processors#apply-a-processor-to-a-specific-type
And add some custom properties to DataExtensions property.
But for rendering these custom properties, we dont have a story yet...
You can override templates (which is not really recommended) but there you don't have access to this data...
https://github.com/RSuter/NJsonSchema/wiki/Templates
We need something like custom renderer which hook into the render process (a special liquid tag to specify allowed types and locations; and special implementations of a new interface, like with schema processors)
... BTW: this is all implemented in http://njsonschema.org which is the base of NSwag
Hi @RicoSuter Would it be possible to add an option to generate either the Display or Description Attribute for enums?
up
Most helpful comment
Hi @RicoSuter Would it be possible to add an option to generate either the Display or Description Attribute for enums?