OpenAPI: Nested Object field incorrectly serialized to string

The error was roughly "failed to marshal string into struct" with the struct being the exact one I saw as a string in the debug console, so I stopped investigating there.

The real issue was actually a field on that struct should have been either undefined or an array, but was being passed as a string by retool. I guess the golang error gets reported based on the struct the field is a part of not the field itself.

When I fixed that and started passing an empty array not an empty string retool worked fine.

Feedback

  • If you show me a field encoded as a string in the debug tools, I'm going to believe it's a string, not a string representation of an object you will parse before sending.
  • If OpenAPI: Enum field cannot be set dynamically, would have worked, I could have avoided all this by not hand-writing JSON in a fragile raw-js environment.

relevant piece of spec (for both here and my other issue):
image

1 Like