API 设计工具
输入
DDD限界上下文
DDD领域模型设计
API
RPC : 更加适用行为, 也就是命令和过程; 如DDD领域模型中的命令
REST : 基于REST的API更加适用于构建模型, 也就是资源和实体; 如DDD领域模型中的实体和值对象
输出
openapi: 3.0.0
info:
description: |
This is a sample DDD api design.
version: "1.0.0"
title: Air Station
contact:
email: wayde.sun@gmail.com
license:
name: Apache 2.0
url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
servers:
# Added by API Auto Mocking Plugin
- description: SwaggerHub API Auto Mocking
url: https://virtserver.swaggerhub.com/oneapicc/station/1.0.0
- description: local
url: https://localhost:8088/oneapicc/station/1.0.0
- url: 'https://oneapi.cc/station/v2'
tags:
- name: Station
description: Everything about Station resources and RPC
paths:
/stations:
post:
tags:
- Station
summary: Add a new station
operationId: createStation
requestBody:
$ref: '#/components/requestBodies/Station'
responses:
default:
description: successful operation
security:
- api_key: []
/stations/{stationId}:
get:
tags:
- Station
summary: Finds Station by stationId
description: Station resource getter
operationId: findStationById
parameters:
- name: stationId
in: path
description: Status id for filter
required: true
explode: true
schema:
type: string
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/Station'
'400':
description: Invalid station id
components:
schemas:
Station:
type: object
properties:
id:
type: integer
format: int64
name:
type: string
requestBodies:
Station:
content:
application/json:
schema:
$ref: '#/components/schemas/Station'
description: Station object that needs to be added to the store
required: true
securitySchemes:
api_key:
type: apiKey
name: jwt
in: header
工具
最后更新于