RicoSuter / NSwag

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

ExtensionData for Operations won't allow objects with properties named "type" #2934

Open kirill-gerasimenko opened 4 years ago

kirill-gerasimenko commented 4 years ago

Hi, I'm using NSwag to generate swagger definition file and using custom IOperationProcessor implementation to add new node at operation's level.

The below code(part of IOperationProcessor.Process method) won't add type property to the result schema, all other fields are added fine, if I use TYPE it is also included, but type seems like is filtered out/ignored.

context.OperationDescription.Operation.ExtensionData[Key] = new
{
     type="any value",
     otherNormalField="other value",
     ...
};

I would assume that extension data has to support any property names - is that correct?

Please advise!

RicoSuter commented 4 years ago

That is strange, maybe "type" is somehow already defined on the operation? Needs investigation.