Swagger-使用不同端口的方案 HTTP 和 HTTPS [英] Swagger- Schemes HTTP and HTTPS with different ports

查看:86
本文介绍了Swagger-使用不同端口的方案 HTTP 和 HTTPS的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何指定具有不同端口的多个架构?具体来说,我想在端口 81 上使用 HTTP,在端口 444 上使用 HTTPS.

How does one specify multiple schema with different ports? Specifically, I want to have HTTP on port 81 and HTTPS on port 444.

swagger: '2.0'
info:
  version: 1.0.0
  title: API for gateways
  description: API for gateways to access server (port 81 for http and 444 for https)
schemes:
  - http
  - https
host: gateway.example.com:81
basePath: /1.0
paths:

推荐答案

这在 OpenAPI 3.0 中可行,但在 OpenAPI/Swagger 2.0 中不可行.

This is possible in OpenAPI 3.0, but not in OpenAPI/Swagger 2.0.

openapi: 3.0.0
servers:
  - url: 'http://gateway.example.com:81'
  - url: 'https://gateway.example.com:444'

这篇关于Swagger-使用不同端口的方案 HTTP 和 HTTPS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆