Swagger-editor: Comment for a $ref in definition fires a semantic error.

Created on 28 Apr 2017  路  13Comments  路  Source: swagger-api/swagger-editor

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).

P1 bug 3.x

Most helpful comment

@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 馃槃

All 13 comments

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?

@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

Alright, I read this wrong 馃槃

Fixing.

Fast & efficient => congrats !!!

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

image

@matthieugeerebaert, it鈥檚 up to date 馃槃 that error looks valid, you can鈥檛 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 https://github.com/swagger-api/swagger-editor/issues/1184 for more context on this.

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 ;)

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

@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 馃槃

Thank you Shockey, perfect !

Hi @shockey,
is there any progress here?

TIA,
Matteo

hi @scara, this is fixed!

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.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

radj picture radj  路  5Comments

jennaprice picture jennaprice  路  4Comments

ljerka picture ljerka  路  5Comments

bluesh55 picture bluesh55  路  3Comments

rrberry picture rrberry  路  4Comments