• AnarchistArtificer@slrpnk.net
    link
    fedilink
    English
    arrow-up
    23
    ·
    edit-2
    19 hours ago

    “This isn’t about being spec-compliant anymore. I need to know the thought process behind this decision. And also please fix it.”

    This unhinged tone is what I live for in blog posts

    Edit: added hyperbole to make humourous intent clearer

  • BatmanAoD@programming.dev
    link
    fedilink
    arrow-up
    9
    arrow-down
    1
    ·
    16 hours ago

    The spec requires errors to be a single string, and also mandates using the space character as a separator? I’m not a fan of deviating from spec, but those are…bad choices in the spec.

    • chaospatterns@lemmy.worldOP
      link
      fedilink
      English
      arrow-up
      12
      ·
      15 hours ago

      The spec mandating its as a single string isn’t that crazy. It’s good to have a consistent response format so a basic deserializer can deserialize any error response object and get something out.

      If you have different providers. One that returns error: { code: string } and another does something else, you end up with the same problem this post talks about-- Inconsistency.

      As far as I can tell, the spec doesn’t limit you to just the one field and you can add other optional fields to the top level to the response that the caller can optionally decide to handle. But if you know there’s going to be a field called error that is a string. You always get at least something out of that to present.

  • chaospatterns@lemmy.worldOP
    link
    fedilink
    English
    arrow-up
    7
    ·
    19 hours ago

    It just goes to show the small parts of API design matter just as much as the big parts. I’ve worked with a lot of engineers who are so eager to draw big boxes and arrow architectural diagrams, but then just rush the details because that’s not important.

    • WanakaTree@lemm.ee
      link
      fedilink
      arrow-up
      5
      ·
      edit-2
      15 hours ago

      A big part of my job is API integrations. The most infuriating one I deal with is a startup who keeps adding new properties with property names randomly being pascal case, camel case, or snake case. Especially when the same property is one case on a request model and different on the response.