szhabolcs
c.json() does not enforce OpenAPI return type
Hello there!
I'm playing around Hono and RPC, and it works great, but for some reason the return type of the handler function is not enforced by the OpenAPI spec that is provided to it. I have searched on github issues and in here, but did not find anyone with the same problem.
It might just be that it's not possible at the moment to do this automatically, but rather I have to type the
c.json<ReturnType, 200>()
myself
Here's a demo:
https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAbzgYygUwIYzQJQgV2wBo4AvEgeTDQDsBBABQEkAJCGiOAXzgDMoIIOAHIAAgAt2EAPSkIAEwC0EajQxhgwgNwAoUJFiI445Nz4ChwyR2nIANsFoxhOncnYBneAMJoAImi8wDTAMMDscAC8KOhYuATYABQIOnBpcCBoMJLyAFwikF7CcBgeKJ4wRKnpYFji+cLS6ADmwF5oUMJV6XDoAI74aF75KT09AEYKAJ4j1WNj7jTYS7Pza+nC6mAOyFjhNNIAVh7swqvrF2keyOJoIBj5pAB0EOOHaMgwyXOXv-geHTUmUeTy8UGCzUSAEoniBgokAKxQ7q-VG1DweADu0DyZFBMHBNEhMLhNESAA4oT9UT0uFSaekuNS1kz1qzGSi0ugPJAaACPOd5gAmAAMIsFF0WyxgEtRmzA22AuzC7COJxoZ0QzIZ11u9xBr3en2+DMuMAgAGtaCCwRDodqaXSHWznRzXWl5ENUMAwCqaA0AMr4ZDIIYeXj4Ox2Ka9NCtdroeRPFxszljAAsIoAnCM4J7ruDffsGgBVAFQEp2WLyGNoAAebRgHmT3DTPQRYtz+e9RfYpZo9eonzQ8jgHQEFYgIfwiZb7LSTLpujcFRKCqicAHmLgVFojFYUntPReqnUwESPmwASCIT9JESyChUQAfFr1tJpHAVLQz7GYDOaDgGApmoOA2k3CB4HGNAIRQW5kCtUdbnQB0PzAuBsUjUcHCtIDxHA80-wAkpAPHaA4Gg3Z-jQMDnDKDh4GyGiPAwTISjKJjYx5TwaM9G9Qn2B10H-KBAOQJ5jnYZIIJlEROOA0CMEmAA3NBii4EhRRFKFdFpHTXB0BSaLoBUABUQJo6IjIgXg1zAX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