Replies: 1 comment
-
|
Hey, really good catch. You’re absolutely right that data is currently sent as null in error cases, but it isn’t explicitly defined as nullable in the OpenAPI schema. I hadn’t run into issues myself because most of my projects just ignored that field when it was null, but for TypeScript/Kotlin/Swift clients using codegen, this could definitely throw type errors. Totally agree we should make data explicitly nullable in the schema so the docs match what’s actually returned at runtime. I was already thinking of updating this with the new version v01.1.17. If you’d like to contribute directly to this (or any other improvement), you’re more than welcome to open a PR. I’m keeping the main branch protected, but contributions and ideas are always appreciated! We can release this feature in the v0.1.17. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Although error responses return data: null at runtime, the field is not defined in the Swagger/OpenAPI schema.
Why It Matters
• Codegen tools (TypeScript, Kotlin, Swift) don’t expect data, causing type or runtime errors.
• Developers avoid using undocumented fields, leading to confusion.
Recommendation
Explicitly define the data field (as nullable) in error response schemas.
This ensures consistency between runtime behavior and API documentation.
Beta Was this translation helpful? Give feedback.
All reactions