Hello

Welcome to my blog, where I document my adventures in software.

Tools for the modern-day developer

Development tools are an essential part of our job, they make us work smarter not harder, they simplify processes and make us more productive. In this post, I want to share some tools that I have found over the years that have made my job easier. If you have a similar experience with a tool that is not listed here, then I would love you hear from you. Grepapp...

November 20, 2021 · Yunier

Idempotency

Idempotency, one of the key features any Web API should have. The idea is that software is unrealiable, the network can fail, the database the API connects to could be offline, the API itself could be performing an intense operation that impacts performance. For all these reasons an API client may resubmit a request, not much of a problem if you are dealing with GET, HEAD, PUT or DELETE, these HTTP methods are idempotent, POST and PATCH on the other hand are not....

November 17, 2021 · Yunier

Sort functions are non-deterministic

When building a Web API, RESTful or GraphQL, you may want to expose some functionality that allows a client application to sort data. From my experience, this is often not implemented correctly. Many developers fail to realize that sorting should always be sort plus one. The plus one is a unique value, like a primary key or identifier. The reason for this is that sorting in most databases, like SQL Server, is nondeterministic, meaning the sort function may return different results each time they are called with a specific set of input values even if the database state that they access remains the same....

November 13, 2021 · Yunier

A practical API validation strategy

In my last post I wrote about how you can leverage JSON Schema to do Web API validation. The main benefit is that the API can expose the schema as an API resource, clients of the API can consume the schema and execute it on their end against any data. The benefit of doing API validation like this is that the client does not need to duplicate any validation logic, they only need to execute the schema....

October 13, 2021 · Yunier

A better API validation strategy

As an API developer, you will eventually need to determine how to handle data validation. The .NET ecosystem offers a few options, the first option, validation attributes, can be used to annotate how a model should be validated. Validation attributes are great, they don’t require any external dependencies, you can specify error messages, create your own custom validator, validate against many data types. For example, take the following Movie class, notice how the properties have been annotated with validation rules....

October 9, 2021 · Yunier