Contributions
C# Class for Swagger.json
I need to parse a swagger.json file to dynamically find out what paths are available and what parameters for instance a POST requires. I do not know the content of it beforehand. Currently I am using the Newtonsoft JSON library to deserialize the swagger.json into a C# object. However, the parsing is kind of cumbersome. It would be so much easier if there was a known class that I can deserialize to. I understand that items like "parameters" will vary from case to case. Anyhow, is there a way to accomplish this? If not, what is the best way to parse a swagger.json file.6.1KViews0likes1CommentCodeGen & Default Constructor
What is the reason the default constructor is set as protected? After all, the code generator is creating a constructor with all default arguments. The problem is thatby setting default values you can't dynamically create instances without providing arguments. So something like this doesn't work System.Type[] types = DLL.GetExportedTypes(); var theType = DLL.GetType("[MyClass]"); var c = System.Activator.CreateInstance(theType); This blog post mentions exactly the same issue:https://nicolas.guelpa.me/blog/2015/03/29/c-sharp-constructor.html Is there a workaround short of modifying the generated code (not good as I would have to redo those changes each time I regenerate the code) or deriving my own class (doesn't work in my case) which simply adds a default constructor?1.5KViews0likes0Comments