ITADN

Equivalent for Swashbuckle MapType

#184ClosedEdToro74 创建于 2024-11-24
E
EdToro74commented
We use the `ValueOf` nuget package to represent typed primitives (for example, IDs of domain objects). In previous versions of .NET, when using Swashbuckle, we were able to use the MapType method to have these show up in the swagger JSON file as the primitive type they were wrapping. For example: ``` services.AddSwaggerGen(options => { options.MapType(typeof(SomeObjectId), () => new OpenApiSchema { Type = "integer", Example = new OpenApiInteger(0) }); }); ``` Is there a way to do this with the existing transformers, or with all the functionality you've added? I tried a basic schema transformer that was able to get the type to show that it was an integer, but it still showed up as a separate type where as the prior solution in Swashbuckle hid the wrapping type completely. Quick edit to add: We already have JsonConverters registered that are able to serialize/deserialize these as the primitive value.
关闭于 2025-03-04 1 条评论