<!-- invalid XML --> in Swagger UI Example Value

421 views
Skip to first unread message

Andrew Campbell

unread,
Aug 15, 2016, 7:01:55 AM8/15/16
to Swagger
I'm getting <!-- invalid XML --> in my Example Values in Swagger UI.

For example

<?xml version="1.0"?> <Comments> <comment> <!-- invalid XML --> </comment> </Comments>

The model looks like this

Comments {
comment (Array[Comment]optional)
}
Comment {}

I have attached a sample Swagger file that displays the problem.

I just can't see what is causing this problem. Can anyone help me?
example.json

Ron Ratovsky

unread,
Aug 16, 2016, 11:42:48 PM8/16/16
to swagger-sw...@googlegroups.com

The problem is the spec is just invalid. The Comments model just doesn’t follow the supported spec.

--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Message has been deleted

Andrew Campbell

unread,
Aug 17, 2016, 5:54:30 AM8/17/16
to Swagger
Thanks. I've used http://bigstickcarpet.com/swagger-parser/www/index.html to find the validation issues with my spec, and I have altered it so it is now valid, at least according to that validator.

I'm still getting the same problem, and I could really use some help in getting this fixed.

Updated spec is attached.
example.json

Ron Ratovsky

unread,
Aug 17, 2016, 4:42:45 PM8/17/16
to swagger-sw...@googlegroups.com

So I don’t really know what you’re trying to describe but if you change the Comment definition to just

"Comment": {

      "type": "object",

      "title": "Comment",

      "required": [

        "id"

      ],

      "properties": {

        "id": {

          "title": "id",

          "type": "string"

        }

      }

    }

it will render as expected.

Keep in mind, ‘null’ is not a valid type, nor is an array of types.

--

Andrew Campbell

unread,
Aug 18, 2016, 5:25:47 AM8/18/16
to Swagger
Thank you!

The problem was the missing "type": "string". This was further obfuscated by a typo in the full 13k line spec; I wouldn't have found either of those problems without your help.

Ron Ratovsky

unread,
Aug 18, 2016, 12:11:23 PM8/18/16
to swagger-sw...@googlegroups.com

Glad to hear you got it sorted out. Swagger on!

 

 

 

 

From: <swagger-sw...@googlegroups.com> on behalf of Andrew Campbell <andrew....@synchronoss.com>
Reply-To: "swagger-sw...@googlegroups.com" <swagger-sw...@googlegroups.com>
Date: Thursday, 18 August 2016 at 02:25
To: Swagger <swagger-sw...@googlegroups.com>
Subject: Re: <!-- invalid XML --> in Swagger UI Example Value

 

Thank you!

 

The problem was the missing "type": "string". This was further obfuscated by a typo in the full 13k line spec; I wouldn't have found either of those problems without your help.

--

Reply all
Reply to author
Forward
0 new messages