NSwag
NSwag copied to clipboard
OpenApiServer does not maintain extensions on generation through CLI
TL;DR: According to the spec (https://swagger.io/specification/) the OpenApiServer object MAY be extended with Specification extensions. However the current implementation does not support that.
Would you accept a PR to enable this support?
We are trying to migrate from Swashbuckle (which seems unmaintained) to NSwag. For an internal API platform we rely on extension properties being attached to (amongst others) the OpenApiServer object (https://github.com/RicoSuter/NSwag/blob/master/src/NSwag.Core/OpenApiServer.cs).
According to the spec (https://swagger.io/specification/) the OpenApiServer object MAY be extended with Specification extensions. However the current implementation does not support that.
We generate our swagger.{json,yaml} using the CLI generator which deserializes and (re-)serializes the original specification generated by our application, and the extensions we added are lost.
From a quick review it seems that extending the OpenApiServer
class with JsonExtensionObject
would solve this issue. If so, then I can provide a pull request for that.
I believe there are more types that according to the spec MAY be extended, but currently don't support extensions. But I haven't look into that too much.