swagger-api / validator-badge

Validate your Swagger JSON/YAML today!
http://swagger.io
Apache License 2.0
210 stars 85 forks source link

Validator doesn't resolve all $refs properly #16

Closed mohsen1 closed 9 years ago

mohsen1 commented 9 years ago

From https://github.com/swagger-api/swagger-editor/issues/388

The spec reported there is perfectly valid.

swagger: "2.0"
info:
  version: 0.0.0
  title: Simple API
paths:
  /:
    get:
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/InternshipResultModel"
definitions:
  InternshipResultModel:
    properties:
      Review:
        schema:
          $ref: "#/definitions/ReviewModel"
  ReviewModel:
    properties:
      Rating:
        type: integer
fehguy commented 9 years ago

@mohsen1 It doesn't validate because the Review has a schema as a property. We can go back and forth whether it should be, however that's the cause.

https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#schema-object

I don't see schema as a supported property for a model.

mohsen1 commented 9 years ago

Thanks @fehguy I totally missed that.

/cc @nvcnvn

fehguy commented 9 years ago

thanks, I was worried that was supported