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

Comment for a $ref in definition fires a semantic error. #1305

Closed
Cooker-Monster opened this issue Apr 27, 2017 · 13 comments
Closed

Comment for a $ref in definition fires a semantic error. #1305

Cooker-Monster opened this issue Apr 27, 2017 · 13 comments

Comments

@Cooker-Monster
Copy link

Cooker-Monster commented Apr 27, 2017

New editor defines "Sibling values are not allowed alongside a $ref." as a Semantic Error as the previous one defined it as a Warning.

I think that put a comment for a $ref is not a semantic error.
Rolling back as warning could be nice (in fact, allowing comment on $ref without warning won't offend me).

@shockey
Copy link
Contributor

shockey commented Apr 28, 2017

Can't reproduce this.

I tried this, and only got a resolver error for the non-existent path:

swagger: "2.0"
info:
  description: "This is a sample server Petstore server.  You can find out more about     Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/).      For this sample, you can use the api key `special-key` to test the authorization     filters."
  version: "1.0.0"
  title: "Swagger Petstore"
host: "petstore.swagger.io"
basePath: "/v2"
schemes:
- "http"
paths:
  /:
    # hello, this is a comment
    $ref: "#/some/path"

@Cooker-Monster, can you provide a test spec for this?

@webron
Copy link
Contributor

webron commented Apr 28, 2017

@shockey

swagger: "2.0"
info:
  description: "This is a sample server Petstore server.  You can find out more about     Swagger at [http://swagger.io](http://swagger.io) or on [irc.freenode.net, #swagger](http://swagger.io/irc/).      For this sample, you can use the api key `special-key` to test the authorization     filters."
  version: "1.0.0"
  title: "Swagger Petstore"
host: "petstore.swagger.io"
basePath: "/v2"
schemes:
- "http"
paths:
  /:
    get:
      responses:
        200:
          $ref: '#/responses/test'
          schema:
            type: string
          
responses:
  test:
    description: hello

@shockey
Copy link
Contributor

shockey commented Apr 28, 2017

Alright, I read this wrong 😄

Fixing.

@Cooker-Monster
Copy link
Author

Fast & efficient => congrats !!!

@matthieugeerebaert
Copy link

It seems that current online swagger editor is not up to date ?

image

@shockey
Copy link
Contributor

shockey commented Jan 11, 2018

@matthieugeerebaert, it’s up to date 😄 that error looks valid, you can’t have any other values alongside a $ref, because $ref works by replacing itself and everything on its level with the data it is pointing at.

see #1184 for more context on this.

@matthieugeerebaert
Copy link

Oups sorry ! I read this issue too quickly, it's only about comment, thought it was a general issue that semantic "Sibling values are not allowed alongside a $ref" should only be warning. And yes #1184 is my current problem. We have hundred of swaggers with attribute description and definition description :( Having now those "Error" is a major problem, I was trying to find honorable workaround :) Sorry for my bad interpretation Shockey ;)

@matthieugeerebaert
Copy link

Hey so using comment instead of description might be a good workaround, thank you !

@shockey
Copy link
Contributor

shockey commented Jan 11, 2018

@matthieugeerebaert no problem!

I just realized that our new validation system is actually reporting this as an error again, so there was something to fix here after all 😄

@matthieugeerebaert
Copy link

Thank you Shockey, perfect !

@scara
Copy link

scara commented Feb 21, 2018

Hi @shockey,
is there any progress here?

TIA,
Matteo

@shockey
Copy link
Contributor

shockey commented Mar 7, 2018

hi @scara, this is fixed!

@scara
Copy link

scara commented Mar 7, 2018

TNX @shockey for the follow up!
Didn't try by myself before your last comment.

Everything looks OK now: a gently warning is fired in the editor while nothing appears in the viewer pane.

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

No branches or pull requests

5 participants