3 posts

A Good Way How to Validate Types in TypeScript

TL;DR: I've created a typescript library fp-ts-type-check. You can use it to validate the structure of data you get from outside of your application.

Here's the situation: your typescript application needs to retrieve some object via some API. You make an API request and you get a successful response with some json. Probably it's the data you expect but you can't say for sure. Your actions?


3 Ways to Make Your API Slow

I had to fix performance issues of one API endpoint. A pretty Symfony endpoint that gathers some data from database, assembling it to some structure and returns it as json.

Performance started being an issue when major part of that "some data" started to be 60000 entities. In worst case response time was almost 20 seconds. "Ok", I thought, "60k is a big enough number to make it slow". But trace showed that retrieving data from DB isn't a slowest part. There were things taking almost 1/3 of request time each. And these things were easy to fix.


Creating an API Documentation in Swagger Using YAML

UPD: I wrote this for swagger v1.2. Stuff has changed since then. Now swagger supports single-file YAML specifications, so making them is easier now. What a time to be alive!

A few days ago was the first time I created a REST API documentation. This is the report on how I did it.