惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Vulnerabilities – Threatpost
U
Unit 42
F
Fortinet All Blogs
aimingoo的专栏
aimingoo的专栏
P
Proofpoint News Feed
F
Full Disclosure
月光博客
月光博客
Engineering at Meta
Engineering at Meta
博客园_首页
The Register - Security
The Register - Security
G
Google Developers Blog
The Cloudflare Blog
博客园 - Franky
K
Kaspersky official blog
A
Arctic Wolf
Scott Helme
Scott Helme
C
Cisco Blogs
Hugging Face - Blog
Hugging Face - Blog
C
Check Point Blog
NISL@THU
NISL@THU
AI
AI
D
DataBreaches.Net
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Stack Overflow Blog
Stack Overflow Blog
Project Zero
Project Zero
The GitHub Blog
The GitHub Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
量子位
Vercel News
Vercel News
T
Tor Project blog
P
Privacy International News Feed
D
Docker
I
Intezer
L
LangChain Blog
P
Proofpoint News Feed
Security Latest
Security Latest
C
CXSECURITY Database RSS Feed - CXSecurity.com
T
Threatpost
博客园 - 聂微东
AWS News Blog
AWS News Blog
Martin Fowler
Martin Fowler
P
Privacy & Cybersecurity Law Blog
V
V2EX
Last Week in AI
Last Week in AI
C
Cybersecurity and Infrastructure Security Agency CISA
The Hacker News
The Hacker News
T
Tenable Blog
Blog — PlanetScale
Blog — PlanetScale
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Tailwind CSS Blog

博客园 - NewSea

Linux 安装IntelAx211无线网卡 解决 K8sApi 部署后报 Unknown apiVersionKind apps/v1/Deployment is it registered? Docker 启动前后端脚本 docker 一键启动 mariadb 分区脚本 Spring笔记--@ConditionalOnBean坑 K8s笔记 ubuntu18+k8s单机版+kuboard+harbor安装笔记 Nginx笔记 k3s+rancher+harbor 笔记 postgresql 笔记 vscode 笔记 发布Jar包到中央仓库 Java开发笔记汇总 - NewSea - 博客园 css 适配 nui-app 笔记 Java里的不能与无用. SSH 配置 Swagger 配置
yapi 自定义Json的数据类型
NewSea · 2020-06-16 · via 博客园 - NewSea

yapi 安装

https://github.com/YMFE/yapi
https://github.com/fjc0k/docker-YApi/blob/master/docker-compose.yml

使用外部数据库 , 外部数据库手机加入网络,手动创建用户。

docker-compose.yml

version: '3'

services:
  yapi-web:
    image: jayfong/yapi:latest
    container_name: yapi-web
    ports:
      - 8300:3000
    environment:
      - YAPI_ADMIN_ACCOUNT=iamnewsea@163.com
      - YAPI_ADMIN_PASSWORD=yxh123
      - YAPI_CLOSE_REGISTER=true
      - YAPI_DB_SERVERNAME=mongo
      - YAPI_DB_PORT=27017
      - YAPI_DB_DATABASE=yapi
      - YAPI_DB_USER=root
      - YAPI_DB_PASS=yxh123
      - YAPI_MAIL_ENABLE=false
      - YAPI_LDAP_LOGIN_ENABLE=false
      - YAPI_PLUGINS=[]
    external_links:
      - mongo
    restart: unless-stopped

docker-compose up -d

数据类型

接口的请求参数,使用Json时,不能自定义数据类型。修改代码太复杂。 直接修改数据库。
思路:

  1. 在 title 定段定义数据类型 , 格式: :IdName,CodeName
  2. 通过数据表 interface 查找 title 字段,以 冒号开头的 接口。并修改接口。

接口地址: http://dev8.cn:8018/dev/yapi/user-types
PostJson: {"connString":"mongo数据库连接字符串","typeMap":{"IdName":"id,name","IdUrl":"id,url","CodeName":"code,name","IntCodeName":{"code":{"type":"number"},"name":{}}}}

执行即可。