[Question] [CSHARP] Disable validation of required fields in model constructor and json
Created by: BenedicteLeo
I am attempting to disable client model validation entirely in C# in order to run negative tests on my service. More specifically, I need my client model classes to not perform null checks in the constructors, and the Json serializer to ignore empty fields. Some of the fields are required in my yaml, but I specifically want to send null values to the service to test its behavior. Is there an easy way to achieve this?
I have set "validatable": false in the config json, but I don't know what this setting is affecting (but it's not what I need).
openapi-generator version
I'm running version 4.1.2 with Swagger 3.0.
Command line used for generation
java -jar openapi-generator-cli.jar generate -i D:...\Blah.yaml -g csharp --config D:...\GeneratorConfig.json
Steps to reproduce
- Have a yaml model with a required field
- Run the above command line operation with a json config containing:
{
"validatable": false, } - Check the model constructor, and observe that there are null checks on the required params.