openai-openapi
openai-openapi copied to clipboard
make function_call optional
The new parameter function_call can be one of three cases:
- an enum of value none or auto
- an object with a name
- null (since it can be omitted)
Without this fix, api generators like NSwag will mark this field as non nullable, causing resulting in API error when sending function_call: none without any function being defined, for example.
The API does not accept a null value here (feel free to test it). Can the generator not just skip passing the property in this case?
I agree with your objection, I will see if using nullable: true on the function_call parameter works
With NSwag, setting optional: true is not enough. A non-null object is defined with default value. setting nullable: true correctly results in an optional (nullable) object. In a way, this is an NSwag issue - it also fails to correctly handle the polymorphism between an enum and an object for this field.
I have flagged this as an issue in NSwag (https://github.com/RicoSuter/NSwag/issues/4459), but if others are are experiencing the same problems with different code generator, it might be worth considering applying this fix unless it results in other code generators to generate the field with null of course