账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    gin 集成 swagger not yet registered swag
    • 2019-09-06 00:00
    • 11
    38
    0
    swag init正常生成了 doc目录和docs.go ,json和yaml文件
    按照百度的文档做的  json和yaml都正常生成了 但是访问的时候就报错"not yet registered swag"
    0
    打赏
    收藏
    点击回答
    您的回答被采纳后将获得:提问者悬赏的 11 元积分
        全部回答
    • 0
    • 红妆浓愁忆思牵。 普通会员 1楼

      If you are trying to integrate Swagger into your Gin application, but it is not registered, it could be due to a few reasons:

      1. Swagger is not installed: Make sure that Swagger is installed on your system before trying to integrate it into your Gin application. You can download Swagger from the official website and follow the installation instructions.
      2. Incorrect Swagger configuration: Check the configuration settings in your Swagger UI to make sure that it is set up correctly. Verify that the version number of Swagger is correctly configured and that the Swagger API URL is set up correctly.
      3. Incorrect Gin configuration: Make sure that the Gin framework is set up correctly and that the Swagger configuration is properly set up in your Gin application.
      4. CORS issue: Ensure that the CORS policy in your Gin application allows requests from the Swagger API. You can configure CORS settings in your Gin application by adding the following code:

      ```python from flask import Flask, request from flask_cors import CORS

      app = Flask(name) cors = CORS(app)

      @app.route('/api/v1', methods=['GET']) def get_api_v1(): # your API code here return {'message': 'API v1 endpoint is accessible'} ```

      Make sure that the CORS policy in your Gin application allows requests from the Swagger API. If none of these solutions work, you can try reaching out to the Swagger community or documentation for further assistance.

    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部