RicoSuter / NSwag

The Swagger/OpenAPI toolchain for .NET, ASP.NET Core and TypeScript.
http://NSwag.org
MIT License
6.61k stars 1.22k forks source link

Adding FromHeader attribute to generated c# objects #4894

Open makten opened 1 month ago

makten commented 1 month ago

Is there a way to automatically add "FromHeader" attribute to generated C# objects using a .nswag file? I have added the following to my .nswag file with no success:

.....
"codeGenerators": {
  "openApiToCSharpController": {
"operationProcessors": [
  {
    "type": "MyNamespace.AddHeaderParameterOperationProcessor, MyAssembly"
  }
]
.....

The AddHeaderParameterOperationProcessor class contains the required logic, but this doesn't seem to do anything.