微服务开发:从设计到实现
1. 设计OpenAPI规范
在确定了微服务的操作和查询之后,我们可以用标准格式来描述要构建的微服务。这里我们将构建RESTful微服务,并使用OpenAPI规范(OAS)进行描述。
1.1 航班管理微服务API规范
以下是航班管理微服务API的OAS示例:
openapi: 3.0.0
info:
title: Flights Management Microservice API
description: |
API Spec for Flight Management System
version: 1.0.1
servers:
- url: http://api.example.com/v1
description: Production Server
paths:
/flights:
get:
summary: Look Up Flight Details with Flight No and Departure Date
description: |
Look up flight details, such as: the unique flight_id used by the
rest of the Flights management endpoints, flight departure and
arrival airports.
Example request:
```
GET http
超级会员免费看
订阅专栏 解锁全文

被折叠的 条评论
为什么被折叠?



