Skip to content

Commit

Permalink
Added draft for contract driven testing
Browse files Browse the repository at this point in the history
  • Loading branch information
harrisoncramer committed Aug 16, 2024
1 parent 1707dda commit bfabcf9
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/content/blog/contract-driven-apis-in-typescript.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
title: Contract Driven APIs in Typescript
pubDate: 2024-08-15
description: Different approaches to enforcing schemas across API boundaries in Typescript
imageDescription: A contract
heroImage: contract
tags: ["typescript", "javascript", "apis"]
slug: contract-driven-apis-in-typescript.mdx
---

In my opinion, one point of technical friction that becomes easier to resolve when working in a single language like Typescript, is the misalignment of your data model with the environment you're mapping.

As you learn more about your domain, whether it's hotels, or bank transactions, or online dating, you need to tweak parts of the codebase that are confusing, to better reflect your understanding of the domain.

Bit by bit, your original mental model fades away. You add on exceptions here, and modifications there.

Having a clear overview of the state of your application's endpoints -- what they return, possible failure cases, and other schema-like attributes, is incredibly helpful.

Here are three approaches to enforcing and sharing that schema across the team.

## OpenAPI and Code Generation

## TRPC

## JSON Schema

0 comments on commit bfabcf9

Please sign in to comment.