Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x-logo is broken #763

Closed
kplachkov opened this issue Jul 27, 2020 · 1 comment · Fixed by #760
Closed

x-logo is broken #763

kplachkov opened this issue Jul 27, 2020 · 1 comment · Fixed by #760

Comments

@kplachkov
Copy link

Describe the bug
Using // @x-logo ... will result x-logo outside the info scope.

To Reproduce
Steps to reproduce the behavior:

  1. Go to main.go
  2. Add:
// @title Example API
// @version 1.0
// @description API
// @x-logo {"url": "https://example.com/img.png", "backgroundColor": "#000000", "altText": "example logo", "href": "https://example.com/img.png"}
  1. Run swag init
  2. Go to docs/swagger.json and docs/swagger.yaml

swagger.json

..................................
    "x-logo": {
        "altText": "example logo",
        "backgroundColor": "#000000",
        "href": "https://example.com/img.png",
        "url": "https://example.com/img.png"
    }
}
<=========================== EOF

swagger.yaml

..................................
swagger: "2.0"
x-logo:
  altText: example logo
  backgroundColor: '#000000'
  href: https://example.com/img.png
  url: https://example.com/img.png
<=========================== EOF

Expected behavior

swagger.yaml

.....................
info:
  contact: {}
  description: API
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  title: Example API
  version: "1.0"
  x-logo:
    altText: example logo
    backgroundColor: '#000000'
    href: https://example.com/img.png
    url: https://example.com/img.png
.................

swagger.json

{
    "swagger": "2.0",
    "info": {
        "description": "API",
        "title": "Example API",
        "x-logo": {
            "altText": "example logo",
            "backgroundColor": "#000000",
            "href": "https://example.com/img.png",
            "url": "https://example.com/img.png"
        },
        "contact": {},
        "license": {
            "name": "Apache 2.0",
            "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
        },
        "version": "1.0"
    },
.................

Your swag version
v1.6.7

Your go version
go version go1.14.6 linux/amd64

Desktop (please complete the following information):

  • OS: Ubuntu
  • Browser: chrome
  • Version: 84
@Nerzal
Copy link
Contributor

Nerzal commented Aug 11, 2020

I already wrote a fix for that + some additional sugar :)
Just needs to be merged :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants