Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Schema-first API Development with OpenAPI and Committee

Shohei Umemoto
March 28, 2023
45

Schema-first API Development with OpenAPI and Committee

Shohei Umemoto

March 28, 2023
Tweet

Transcript

  1. 2023/03/28
    Ruby Jam 3
    月場
    @cafedomancer
    Schema-first API
    Development with
    OpenAPI and
    Committee

    View full-size slide

  2. Introduction

    View full-size slide

  3. Shohei Umemoto
    Hokkaido, Japan
    Rails, Next.js, Flutter
    Enishi Tech Inc.
    Fjord Boot Camp

    View full-size slide

  4. Pocco
    Popsicles for children
    Ingredients from Hokkaido
    App: + API:
    Interacting by REST API

    View full-size slide

  5. Schema-first

    View full-size slide

  6. NOT Schema-first (Schema-last?)
    Web API Development
    Backend
    1. Design
    2. Develop
    3. Verify
    4. Release
    Frontend
    1. Wait
    2. Wait
    3. Wait
    4. Develop
    5. Uh-oh

    View full-size slide

  7. Schema-first Web API
    Development
    Backend
    1. Schema 🤝
    2. Develop
    3. Verify
    4. Release
    Frontend
    1. Schema 🤝
    2. Develop
    3. Verify
    4. Release

    View full-size slide

  8. OpenAPI Specification (OAS)
    Web API specification
    written in YAML or JSON
    Useful tools for OAS, like
    Swagger Editor, Swagger UI,
    Swagger Codgen

    View full-size slide

  9. Committee and Committee::Rails
    Committee: Rack middleware to validate requests and
    responses along with OAS
    Committee::Rails: Rails integration to utilize assertions like
    - assert_request_schema_confirm
    - assert_response_schema_confirm

    View full-size slide

  10. Demonstration

    View full-size slide

  11. cafedomancer/petstore
    https://github.com/cafedomancer/petstore

    View full-size slide

  12. Pros and Cons
    Pros: No outdated specification and documentation
    Pros: Promote collaborating and reduce reworking
    Cons: Learn about OpenAPI Specification
    Cons: Committee doesn't always cover every cases

    View full-size slide

  13. Thanks for listening
    Taiwan: Any conferences?
    Japan: RubyKaigi!
    Let's talk in Chinese, Japanese,
    English 🤣

    View full-size slide