Table of Contents
- prerequesities
- demo
prerequesities
swagger editor 2.0
Demo
代码语言:javascript复制swagger: '2.0'
info:
description: API for user Service
version: 1.0.0
title: user Service API
basePath: /user-v1
schemes:
- https
produces:
- application/json
paths:
/user:
get:
tags:
- user
summary: get all user info.
description: >-
get all user info.
operationId: getUsers
responses:
'200':
description: Successful response returns option key state
schema:
type: array
items:
$ref: '#/definitions/User'
definitions:
User:
description: user object
type: object
properties:
userId:
description: user uuid
type: string
example: "hjkhfkashfweuiorfjlsamfma"
userName:
description: user name
type: string
example: "james"
userAge:
description: user age
type: integer
example: 18
userLoginStatus:
description: user login status
type: string
$ref: '#/definitions/UserLoginStatus'
UserLoginStatus:
description: user login status
type: string
enum:
- LOGINED
- REGISTERED
Order:
description: user order
type: object
properties:
orderId:
description: order uuid
type: string
example: "JD7832"
orderName:
description: order name
type: string
example: basketball
// create a map structure by using additionalProperties
// https://support.reprezen.com/support/solutions/articles/6000162892-support-for-additionalproperties-in-swagger-2-0-schemas
UserOrderMap:
description: the map user to order
type: object
properties:
userOrderMap:
type: object
additionalProperties:
$ref: '#/definitions/Order'