logoalt Hacker News

jillesvangurp12/09/20241 replyview on HN

Good API design dictates that you should be flexible as to what you accept and strict about what you serve. Being flexible doesn't really break anything.

Elasticsearch and Opensearch both actually have partial support for JSON5 (comments), which is a nice feature if you want to document e.g. a complex query or mapping choice. It won't return any comments in the response. So it won't break other parsers. Implementing JSON 5 support like this is a valid thing to do for any server. More broad support for this in parsers would be nice.

I'd probably enable this on my own servers if this was possible. I'd need that to be supported in kotlinx.serialization. See discussion on this here: https://github.com/Kotlin/kotlinx.serialization/issues/797


Replies

fifilura12/09/2024

> Good API design dictates that you should be flexible as to what you accept and strict about what you serve. Being flexible doesn't really break anything.

Do you have a source on that? I am not sure I agree. My gripe is with HOCON that accepts so many formats that after a while you have no idea what it is you are actually writing. You can have a conf file with 5 different formats of the same type of setting. Probably added to by 5 different developers.

I'd rather have it throw an error in my face when I don't adhere.