V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
fly2never
V2EX  ›  问与答

Swagger 怎么做 Reponse 的 validate?

  •  
  •   fly2never · Jul 19, 2017 · 2572 views
    This topic created in 3216 days ago, the information mentioned may be changed or developed.

    我们用 Swagger 做 API 规范, 在 Swagger-ui 中有一个 try it out 的功能, 可以请求服务器和展示 Response.但是我没有找到任何地方可以根据 Swagger 的 API 定义去验证返回 json 的正确性.

    比如 API 定义了返回字段里面必须有 id, 而且这个字段是 integer, 结果服务器接口返回的是 string 或者压根没有这个字段, 这个时候 try it out 显示的结果应该报错, Swagger 有这个功能吗? 如果不行是不是只能用 postman 自己写测试了?

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   968 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 20:17 · PVG 04:17 · LAX 13:17 · JFK 16:17
    ♥ Do have faith in what you're doing.