導入#
どのアプリケーション開発プロセスにおいても、バックエンドとフロントエンド開発者間のシームレスな調整を達成することが最も重要です。これは、プロジェクトの効率的な提供を保証するだけでなく、誤解を最小限に抑え、開発時間を短縮し、製品の品質を向上させます。提案された開発計画プロセスは、これら2つの重要な役割間のより良い同期の必要性に対処します。
背景と動機#
Retrospecのフィードバックは、APIの可視性と計画における重要なギャップを強調しました。急速な技術進歩により、動的で適応可能なシステムへのニーズが高まっています。提案された方法は、計画段階でバックエンドとフロントエンドの両方のエンジニアを組み込み、最初から明確性と整合性を確保することを目指しています。
提案されたプロセス#
1. 代表者の選出:#
毎週、1人のバックエンドと1人のフロントエンドエンジニアが選ばれます。これらの代表者は、スプリントの要件を理解し、現在の計画OpenAPIスキーマと整合させる責任を負います。
2. レビューと改訂:#
選ばれたエンジニアは、協力してOpenAPI設定をレビューします。彼らは、それが要件と整合していることを確認し、必要に応じて改訂を行います。このコラボレーションにより、両側が達成すべきことを明確に理解できます。
3. コミットと生成:#
改訂後、OpenAPI設定への変更は、それぞれのリポジトリにコミットされます。これに続いて、CI/CDは提供されたyamlを使用してモックAPIを生成します。
4. スプリントの完了:#
スプリントの完了時に、新しいyamlが生成されます。このyamlは、次のスプリントのAPI要件をカプセル化します。
ツールと管理:#
YAMLの視覚化: Swagger Editorにあるオンラインツールを利用して、yamlをアップロードしSwaggerドキュメントとして視覚化できます。
OpenAPIドキュメント管理: この提案されたプロセスは純粋に計画段階のためのものであることを理解することが重要です。APIが展開されたら、それぞれのサービスはそのopenapi.jsonを生成する必要があります。このJSONは、ダウンロードしてさらなる計画のために再利用できます。
CI/CDの役割: CI/CDパイプラインは極めて重要な役割を果たします。yamlファイルを受け入れ、仕様に基づいてモックサーバーを展開するように設計する必要があります。この目的には、openapi-mockのようなツールを検討できます。
このプロセスが有益な理由:#
コミュニケーションの強化: 計画プロセスにバックエンドとフロントエンドの両方のエンジニアを含めることで、直接的なコミュニケーションラインが確立されます。これにより、誤解や曖昧さが最小限に抑えられ、より合理化された開発プロセスが実現されます。
整合性の向上: 両チームは、API要件と機能について明確な理解と合意を持つことができます。これは、開発フェーズ中の行き来が少なくなることを意味します。
効率性: 仕様に基づいてモックサーバーが展開されることで、開発者は遅延なく作業を開始でき、より迅速な製品リリースにつながります。
品質保証: バックエンドとフロントエンドの両方の開発者が最初から関与すると、重要な要件を見落とす可能性が減少します。これにより、より堅牢でよく機能する最終製品が生まれます。
結論#
提案された開発計画プロセスは、バックエンドとフロントエンドエンジニア間のコラボレーションを強調しています。視覚化のためのSwaggerやモックサーバー展開のためのopenapi-mockなどのツールを使用することで、プロセスはコミュニケーションギャップを埋めるだけでなく、開発されたAPIが要件と完全に整合することを保証します。技術が進化し続ける中、このようなプロセスは、チームが製品の品質を維持しながら需要に追いつくことを確保します。
付録A - yamlの例#
openapi: 3.1.0
info:
title: PKY Sprint 3
description: |-
PKY Sprint 3 Development Schema
termsOfService:
contact:
email: jared@lynskey.co.nz
license:
name: None
url:
version: 1.0.11
externalDocs:
description:
url:
servers:
- url: https://api-mock.com/api/v3
tags:
- name: curation
description: PKY-1081 Curated Lists Feature
externalDocs:
description: Jira Epic
url: https://pickydev.atlassian.net/browse/PKY-1081
paths:
/curations:
get:
tags:
- curation
summary: Return the curations created by users
description: Returns a map of status codes to quantities
operationId: getCurations
responses:
'200':
description: successful operation
content:
application/json:
schema:
type: object
additionalProperties:
type: integer
format: int32
security:
- api_key: []
/curations/{curationId}:
get:
tags:
- curation
summary: Find purchase order by ID
description: For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions.
operationId: getOrderById
parameters:
- name: orderId
in: path
description: ID of order that needs to be fetched
required: true
schema:
type: integer
format: int64
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/Order'
application/xml:
schema:
$ref: '#/components/schemas/Order'
'400':
description: Invalid ID supplied
'404':
description: Order not found
delete:
tags:
- curation
summary: Delete purchase order by ID
description: For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors
operationId: deleteOrder
parameters:
- name: orderId
in: path
description: ID of the order that needs to be deleted
required: true
schema:
type: integer
format: int64
responses:
'400':
description: Invalid ID supplied
'404':
description: Order not found
components:
schemas:
Curation:
type: object
properties:
id:
type: integer
format: int64
examples: [10]
curationId:
type: integer
format: int64
examples: [198772]
quantity:
type: integer
format: int32
examples: [7]
status:
type: string
description: Order Status
examples: [approved]
enum:
- placed
- approved
- delivered
complete:
type: boolean
xml:
name: order
ApiResponse:
type: object
properties:
code:
type: integer
format: int32
type:
type: string
message:
type: string
xml:
name: '##default'
requestBodies:
Curation:
description: Curation object that needs to be added
content:
application/json:
schema:
$ref:
application/xml:
schema:
$ref:
securitySchemes:
petstore_auth:
type: oauth2
flows:
implicit:
authorizationUrl:
scopes:
write:curations: modify curations in your account
read:curations: read your curations
api_key:
type: apiKey
name: api_key
in: header
