Allow passing JsonSerializerSettings to OpenApiExampleResolver
Currently, we can pass naming strategy to the Resolve() methods, but I have additional settings (e.g. custom converters) I would like to use for generating examples.
I feel it would be handy to pass serializer settings to resolve, or use JsonConvert.DefaultSettings to get the default settings, which we can set in startup.
@toriverly Thanks for the issue! I'll take a look.
As this introduce breaking change to IOpenApiExample<T>, it should be re-labelled to v2.0.0
#613 takes care of this issue
As far as I can tell, #613 allowed naming strategy to be set in OpenApiConfigurationOptions, but did not address passing JsonSerializerSettings to Resolve() or using JsonConvert.DefaultSettings(). We are still unable to specify custom converters or additional serializer settings.
private static JsonSerializerSettings settings = new JsonSerializerSettings();
var resolver = new DefaultContractResolver() { NamingStrategy = namingStrategy ?? new DefaultNamingStrategy() };
settings.ContractResolver = resolver;
var openApiExampleValue = OpenApiExampleFactory.CreateInstance<T>(instance,settings);
There was interest in configuring JsonSerializerSettings mentioned in issue #485 as well.