![](/static/0b35d4a1/assets/icons/icon-96x96.png)
![](https://programming.dev/pictrs/image/8140dda6-9512-4297-ac17-d303638c90a6.png)
Every day pretty much with Unix tools. Vim, awk, sed, etc.
Every day pretty much with Unix tools. Vim, awk, sed, etc.
That’s what the If-Match header is for. It prevents this problem.
That being said, I generally think PUT
s are preferable to PATCH
es for simplicity.
It’s about making APIs more flexible, permissive, and harder to misuse by clients. It’s a user-centric approach to API design. It’s not done to make it easier on backend. If anything, it can take extra effort by backend developers.
But you’d clearly prefer vitriol to civil discourse and have no interest in actually learning anything, so I think my time would be better spent elsewhere.
As I already said, it’s very simple with JSON Patch:
[
{ *op": "replace", "path": "/Name™, "value": "otherName"}
]
Good practice in API design is to permissively accept either undefined or null to represent optionality with same semantics (except when using JSON Merge Patch, but JSON Patch linked above should be preferred anyway).
The semantics of the API contract is distinct from its implementation details (lazy loading).
Treating null and undefined as distinct is never a requirement for general-purpose API design. That is, there is always an alternative design that doesn’t rely on that misfeature.
As for patches, while it might be true that JSON Merge Patch assigns different semantics to null and undefined values, JSON Merge Patch is a worse version of JSON Patch, which doesn’t have that problem, because like I originally described, the semantics are explicit in the data structure itself. This is a transformation that you can always apply.
Zalando explicitly forbids it in their RESTful API Guidelines, and I would say their argument is a very good one.
Basically, if you want to provide more fine-grained semantics, use dedicated types for that purpose, rather than hoping every API consumer is going to faithfully adhere to the subtle distinctions you’ve created.
Only if using JSON merge patch, and that’s the only time it’s acceptable. But JSON patch should be preferred over JSON merge patch anyway.
Servers should accept both null and undefined for normal request bodies, and clients should treat both as the same in responses. API designers should not give each bespoke semantics.
Confused what you mean. OpenAPI has nothing to do with JS.
Pretty dumb, honestly. If anything it just adds a Streisand effect to it as people try to figure out what’s censored.
Not that censoring it has any value whatsoever. Like if a child sees that, so fucking what?
Yeah it’s not all that uncommon in school, just increasingly uncommon in industry.
Visual… programming languages? Yikes.
Common Lisp isn’t a functional programming language. Guile being based on Scheme is closer, but I’d still argue that opting into OOP is diverging from the essence of FP.
If the MR is anything bigger than a completely trivial change in a file or 2, it most likely should be broken into multiple commits.
A feature is not atomic. It has many parts that comprise the whole.
Commits should be reasonably small, logical, and atomic. MRs represent a larger body of work than a commit in many cases. My average number of (intentionally crafted) commits is like 3-5 in an MR. I do not want these commits squashed. If they should be squashed, I would have done so before making the MR.
People should actually just give a damn and craft a quality history for their MRs. It makes reviewing way easier, makes stuff like git blame
and git bisect
way more useful, makes it possible to actually make targeted revert commits if necessary, makes cherry picking a lot more useful, and so much more.
Merge squashing everything is just a shitty band-aid on poor commit hygiene. You just get a history of huge, inscrutable commits and actively make it harder for people to understand the history of the repo.
Just remember that if you aren’t actually concatenating files, cat
is always unnecessary.
If you mean for programming specifically, I… don’t, really. At most it would be for a quick sanity check on syntax in a language I don’t write often, for which Google is fine. But otherwise I rely on documentation and search features of the various language/tool-specific websites.
https://porkmail.org/era/unix/award#cat
jq < file.json
cat
is for concatenating multiple files, not redirecting single files.
Meanwhile, I can open a 1GB file in (stock) vim without any trouble at all.
Formatting is what xmllint
is for.
:syntax off
and it works just fine.
It has the return type declared to be
double
.