Forum Discussion

ramster's avatar
ramster
New Contributor
8 years ago

malformed or unreadable swagger supplied

My document looks ok and verifies as a valid YAML/Json

However, I get from swaggerhub editor a "malformed or unreadable swagger supplied"

this is my api:

https://app.swaggerhub.com/api/redramster/talenyaext/1.0.1

can you please advise?

thanks

ramster

  • Okay, that one was a bit tricky. Under your Employer definition you have:

     

     

        locations:
            type: "array"
            items:  {
              $ref: "/definitions/Location"
            }

     

    It should actually be (notice the extra #):

     

        locations:
            type: "array"
            items:  {
              $ref: "#/definitions/Location"
            }

    That should solve the issue.

    Also, if you want to utilize YAML to the fullest, you can write it all as:

     

        locations:
            type: array
            items: 
              $ref: "#/definitions/Location"
  • Okay, that one was a bit tricky. Under your Employer definition you have:

     

     

        locations:
            type: "array"
            items:  {
              $ref: "/definitions/Location"
            }

     

    It should actually be (notice the extra #):

     

        locations:
            type: "array"
            items:  {
              $ref: "#/definitions/Location"
            }

    That should solve the issue.

    Also, if you want to utilize YAML to the fullest, you can write it all as:

     

        locations:
            type: array
            items: 
              $ref: "#/definitions/Location"
    • ramster's avatar
      ramster
      New Contributor

      gee, that was quick!! :) thanks a lot.

      I wonder why your validator did not point me there and just gave a general error

      • RonRatovsky's avatar
        RonRatovsky
        Staff

        That's a good question. I'll open a ticket internally about it so we can track it down.