Made with KolourPaint and screenshots from Kate (with the GitHub theme).

  • NotSteve_@lemmy.ca
    link
    fedilink
    arrow-up
    7
    ·
    1 day ago

    Are you the person who’s writing these APIs that just return dynamically generated untyped JSON that I need to deal with on my team at work? Typing absolutely matters and I will die on this hill

    • PowerCrazy@lemmy.ml
      link
      fedilink
      English
      arrow-up
      1
      ·
      edit-2
      24 hours ago

      How can my JSON response have any concept of Type? If I return a number and you treat it is a string, my API doesn’t have any concept of that. Now in the actual spec of the API I could say that specific URI will return an int, but it’s up to your side to classify the array of bits as an int instead of a str.

      • NotSteve_@lemmy.ca
        link
        fedilink
        arrow-up
        1
        ·
        edit-2
        13 hours ago

        I guess it’s less the response itself but the response objects in the codebase. The main code base I work on is fully typed Python/FastAPI but we depend on an API from another team that was, up until recently, untyped entirely. The responses were just dictionaries that were dynamically generated randomly in 10 layer deep functions. There was absolutely no way to tell what they would actually return, let alone what types they would be. It’s like, if you see a function that’s just called get_big_fat_entity_findings() with no typing, how would you handle that without spending an hour reading through the code line by line? Typing is important for any project that’s bigger than a quick script