Slide 1

Slide 1 text

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

Slide 2

Slide 2 text

Introduction

Slide 3

Slide 3 text

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

Slide 4

Slide 4 text

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

Slide 5

Slide 5 text

Schema-first

Slide 6

Slide 6 text

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

Slide 7

Slide 7 text

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

Slide 8

Slide 8 text

How-to

Slide 9

Slide 9 text

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

Slide 10

Slide 10 text

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

Slide 11

Slide 11 text

Demonstration

Slide 12

Slide 12 text

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

Slide 13

Slide 13 text

Conclusion

Slide 14

Slide 14 text

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

Slide 15

Slide 15 text

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