在我的 Swagger UI 文档的 swagger.json 中,我在哪里将 validatorURL 标志设置为 NULL?

Where do I set the validatorURL flag to NULL in the swagger.json for my Swagger UI docs?

我使用 Swagger 编辑器为我的 API 创建了 Swagger UI 文档,这些文档托管在私有 AWS EC2 实例上。 VM 是私有的,Swagger 无法验证我的 URL,因此我在我的 Swagger UI 网页上收到此错误:

{"schemaValidationMessages":[{"level":"error","message":"Can't read from file https://xx.xx.xxx.xx:9001/static/swagger.json"}]}

我将 Swagger Editor 生成的 YAML 转换为 swagger.json 并将 flask_swagger_ui Python 库用于 link swagger.json 和我的 API 代码。这个 swagger.json 是我拥有的唯一与 Swagger 相关的文件,我没有使用任何 .html 或 .config 文件。我意识到如果我设置 ValidatorURL: null 那么上述错误将停止但是我在哪里添加 swagger.json (Swagger YAML 设计)文件中的 flag/parameter ?其他资源提到在 .html 文件中添加 ValidatorURL: null 但我没有任何此类文件。我该怎么办?

validatorUrl 是一个 Swagger UI 配置选项。在flask_swagger_ui中,您可以按如下方式设置此选项:

swaggerui_blueprint = get_swaggerui_blueprint(
    SWAGGER_URL,
    API_URL,
    config={
        'validatorUrl': 'none'
    },
    ...
)