Git Product home page Git Product logo

openapi-driven-development's Introduction

Introduction

This repo demonstrates how "OpenAPI Driven Development". What I call using OpenAPI as a form of guardrail. My goal is to show how:

  1. Generating OpenAPI from code can help avoid "doc drift". The uneasy case when the docs differ than what the backend does.
  2. How including the OpenAPI schema inside can be a form of "checks and balances". Automated checks can verify that API changes are backward compatible.
  3. Finally, we can cut down the toil with automated publishing of OpenAPI artifacts like pydantic models and typescript clients.

Import Files

  • pyproject.toml the version here is the version for the service and our OpenAPI schema. We choose CalVer but alternative schemes are doable. The intent is to mark changes to the API clearly.
  • bin/openapi this is a simple bash script with test, update, and packages commands. The script is used by Makefile and .gitlab-ci-yaml as examples of how to setup a convenient experience for the developer. e.g. bin/openapi update updates your openapi/schema.yaml and bin/openapi test compatibility will check against main (the master branch of the repo) if there have been backward incompatible changes in your changes.
  • packages/books_pydantic/package.json and packages/typescript_client/package.json both are examples of how a "package" can be added easily by ensuring you have a package.json with update, setup, and publish scripts. The bin/openapi packages hooks into these!
  • books is an example (very contrite) FastAPI service.

openapi-driven-development's People

Contributors

ibolmo avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.