CarterCommunity / Carter

Carter is framework that is a thin layer of extension methods and functionality over ASP.NET Core allowing code to be more explicit and most importantly more enjoyable.
MIT License
2.11k stars 174 forks source link

OpenApi JsonIgnore Support #263

Closed Dreamwalker666 closed 3 years ago

Dreamwalker666 commented 3 years ago

I think the JsonIgnore attribute should be honored so members marked with this aren't output in the schema.

Now of course this brings in the which serialize scenario! So I propose its stored as an option something like:

Type IgnoreAttribute { get; set; } = typeof(System.Text.Json.Serialization.JsonIgnoreAttribute);

(And of course defaulting to .NET core inbuilt)

Now this does mean original behavior can be achieved by setting the setting to null as well. And also means Json.NET can be supported by swapping the value.

Another options is as standard its set to null and you have to opt into members being ignored