#第一部分基本配置信息
#采用 swagger版本
swagger: ‘2.0’

#项目信息
info:
version: “1.0.0”
title: 社交项目-基础-城市API

#主机地址
host: localhost:9001
#基础路径
basePath: /base
#API的传输协议
schemes:

  • #减号代表多个值
    http
  • https

#提交参数格式
consumes:

application/json

#响应结果格式
produces:

application/json

#第二部分定义 url配置 什么请求 提交方式 什么参数都在这儿
paths:
#新增城市数据
/city:
post: #提交方式
description: 新增城市数据
parameters: #指定提交参数(名称-参数类型-是否必填)
-
name: body #参数通过请求体提交 -json数据
in: body #提交参数格式 body:json数据 path:url地址提交参数 /{cityId}
#query:url地址提交参数 ?cityId=123
required: true
description: 城市实体信息
#引用定义实体
schema:
$ref: ‘#/definitions/City’
responses: #响应结果
200:
description: 请求成功
schema:
$ref: ‘#/definitions/ApiResponse’
#根据id查询记录
get:
summary: 根据id查询城市数据
description: 根据id查询城市数据
parameters:
-
name: cityId
in: path
type: string
required: true
description: 城市主键
responses:
200
description: OK
schema:
$ref: ‘#/definitions/ApiListResponse’
#修改城市数据
/city/{cityId}:
put:
summary: 根据城市id更新成熟数据
description: 根据城市id更新成熟数据
#处理参数
parameters:
-
in: path
name: cityId
type: string
required: true
definitions: 城市主键
responses:
200:
description: OK
schema:
$ref: ‘#/definitions/ApiResponse’
#删除城市数据
delete:
summary: 根据id删除城市数据
description: 根据id删除城市数据
parameters:
-
in: path
name: cityId
type: string
description: 城市主键
required: true
responses:
200:
definitions: OK
schema:
$ref: ‘#/definitions/ApiResponse’
##条件分页查询
/city/search/{page}/{size}:
post:
summary: 条件分页查询
description: 条件分页查询
-
name: page
in: path
type: integer
format: int32
required: true
description: 当前页码
-
name: size
in: path
type: integer
format: int32
required: true
description: 页大小
-
name: body
in: body
description:
required: false
schema:
$ref: ‘#/definitions/City’
responses:
200:
description: OK
schema:
$ref: ‘#/definitions/ApiPageResponse’

#第三部分定义实体&返回返回结果
definitions:
City:
type: object
properties: #定义实体中包含属性
id:
type: string
description: 城市主键
name:
type: string
description: 城市名称
ishort:
type: string
description: 是否热门 1热门 2非热门
ApiResponse: #增删改返回结果 flag,code,message
type: object
properties:
flag:
type: boolean
description: 是否成功
code:
type: integer
format: int32
description: 返回业务状态码
message:
type: string
description: 返回业务提示信息
CityList: #定义城市数组
type: arry
items: #指定数组中元素
$ref: ‘#/definitions/City’
ApiListResponse:
type: object
properties:
flag:
type: boolean
description: 是否成功
code:
type: integer
format: int32
description: 返回业务状态码
message:
type: string
description: 返回业务提示信息
data:
$ref:’#/definitions/CityList’
ApiPageResponse: #分页返回结果
type: object
flag:
type: boolean
description: 是否成功
code:
type: integer
format: int32
description: 返回业务状态码
message:
type: string
description: 返回业务提示信息
data:
type: object
properties:
total:
description: 总记录数
type: integer
format: int32
rows:
#description: 当前页记录
$ref: ‘#/definitions/CityList’

YAML Syntax Error Duplicated mapping key at line 62, column 24: description: 城市主键相关推荐

  1. Altium 导入 HyperLynx 提示 Syntax error: L is missing in line 774

    原因: Altium 的 元件 Comment 名中 存在括号等在HyperLynx中为非法的字符:如: R1(101); 1. 可以用文本文件打开hyp文件,查看774行为哪个元件, 2.回到Alt ...

  2. mysql重新设置主键生成策略为auto_increment时报错:resulting in duplicate entry '1' for key 'PRIMARY'

    现在有一个标签表,里面已经填入了一些数据了,想把主键生成策略改成自增的: ALTER TABLE `tags` CHANGE COLUMN `Id` `Id` INT(11) NOT NULL AUT ...

  3. 主键约束(primary key,简称PK)

    主键约束的相关术语?         主键约束:就是一种约束.         主键字段:该字段上添加了主键约束,这样的字段叫做:主键字段         主键值:主键字段中的每一个值都叫做:主键值. ...

  4. 2、MySQL主键(PRIMARY KEY)

    主键(PRIMARY KEY)的完整称呼是"主键约束",是 MySQL 中使用最为频繁的约束.一般情况下,为了便于 DBMS 更快的查找到表中的记录,都会在表中设置一个主键. 主键 ...

  5. Oracle数据库-主键(primary key)、外键(foreign key)、候选键(candidate key)、超键(super key)和references总结...

    主要介绍一下个人对主键(primary key).外键(foreign key).候选键(Candidate key).超键(super key).references的总结 概念: 主键:用户选择元 ...

  6. MySQL主键约束-PRIMARY KEY

    文章目录 建表时设置主键约束 1.单字段主键 2.联合主键 修改表属性时添加主键约束 删除主键约束 主键即主键约束.分为单字段主键和多字段组合主键. 使用主键时,应注意:       1.每个表只能有 ...

  7. default默认值 unique单列唯一和联合唯一 primary key主键 auto_increment自增 外键foregin key 表与表之间关系

    约束条件 之前讲过: zerofill (填充0) unsigned (约束条件值unsigned 无符号) not null 非空(不能插入空) 补充知识点 插入数据的时候可以指定字段 create ...

  8. 主键(primary key)的设置和添加

    主键(primary key)的设置和添加 1.先创建了表,往表里添加主键 mysql> alter table user-> add primary key(useID); 2.创建表时 ...

  9. mysql 复合主键更新_MySQL复合主键下ON DUPLICATE KEY UPDATE语句失效问题

    问题的起因,假设有一张表,里面保存了交易订单,每张订单有唯一的ID,有最后更新时间,还有数据,详情如下: 针对这张表会做追加及更新的操作,具体来说就是如果订单不存在就INSERT一条新的,如果已存在就 ...

  10. 重建分区表主键 - Recreate Primary Key on a partition table

    问题: 重建分区表索引时,碰到一个错误: *Partition columns for a unique index must be a subset of the index key* 故事原型: ...

最新文章

  1. python变量类型-【干货】Python基础语法之变量类型
  2. ARC-060C - Tak and Cards - 动态规划
  3. 2 Effect Hook
  4. ruby mysql 驱动_windows下Rails安装MySql驱动的配置
  5. html段落前的空格,HTML空格:空格前后
  6. 线程优先级抢占实验【RT-Thread学习笔记 3】
  7. php 不同数据库的调用方法,php连接不同数据库的几种方法
  8. vba excel 取得chart保存图片_保存Excel中的图片
  9. 公交车刮擦 两名驾驶员丢下乘客下车“开战”
  10. 沫沫金:EasyUI 固定列
  11. java/php/net/python高校教材管理系统设计
  12. grub4dos 加载 MEMTEST+86
  13. 大型系统集成项目流程方案设计图
  14. java redis 删除整个hash_redis中hash表内容删除的方法代码
  15. esp8266_deauther第四篇
  16. windows10LTSC下载与安装
  17. 使用easypoi操作excel
  18. 《STM32学习笔记》4——核心功能电路与编程(下)
  19. 浏览器:免费小说的“下一站”
  20. 阅读开源Python脚本学习笔记1,之python异常

热门文章

  1. R语言图片有中文保存为PDF乱码怎么解决
  2. 怎么看公司邮箱服务器地址,怎么看企业邮箱是哪里的
  3. 如何批量获取过期老域名
  4. 饥荒联机版steam专用服务器创建
  5. android swap 大小,android 手机内存SWAP经验
  6. jira后台统计数据的一些sql(包含reopen计算,时效)
  7. 测试工程师如何规划自己的职业生涯
  8. 安徽软件技术职业适应性测试,2019年职业适应性(职业技能)测试纲要
  9. adb shell循环命令_android adb实用命令小结
  10. mysql 1138_mysql ERROR 1138: Invalid use of NULL value