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

フロントエンドとバックエンドのコミュニケーションをスムーズにするスキーマ駆動開発

 フロントエンドとバックエンドのコミュニケーションをスムーズにするスキーマ駆動開発

shimakaze-git

December 10, 2023
Tweet

More Decks by shimakaze-git

Other Decks in Programming

Transcript

  1. /api/users というエンドポイントを想定 openapi: 3.0.0 info: title: Sample API Response version:

    1.0.0 paths: /users: get: summary: Get Users responses: '200': description: Successful response content: application/json: schema: type: object properties: users: type: array items: type: object properties: id: type: integer example: 1 name: type: string example: "test" shimakaze-soft 20
  2. モックのAPIを構築できる OpenAPIのファイルを元にモックサーバーを構築できる version: "3" services: mock: image: stoplight/prism:3 container_name: auth_api_mock

    platform: linux/amd64 tty: true ports: - 7501:4010 volumes: - ./openapi/openapi.yml:/openapi.yml:cached command: | mock -h 0.0.0.0 /openapi.yml shimakaze-soft 21
  3. 実装とスキーマに差分が出る New Endpoints: 10 PUT /api/users GET /api/usrs Deleted Endpoints:

    None Modified Endpoints: None GET /api/users/{usre_id} Responses changed Modified response: 200 Content changed Modified media type: application/json Schema changed Properties changed Modified property: general Required changed New required property: stores Deleted required property: store Properties changed New property: stores Deleted property: store shimakaze-soft 34