apigee-127 / swagger-tools

A Node.js and browser module that provides tooling around Swagger.
MIT License
701 stars 373 forks source link

Validating self referring field not working. #546

Closed JaekwanLee closed 6 years ago

JaekwanLee commented 6 years ago

It seems the validator does not validate schema if it refers to other fields. We have a tree like structure

{

  "item" : {
     type: object
     required: [ id, content],
     properties: {
        id: { type: string },
        content: 
            $ref: "#/definition/connents"
     }
 }
  "definition": {
     content: {
       type: object,
       required: [ payload ]
       properties: {
          auth: { type string}
          payload: { type .......}
      }
  }
}

Validating http request with middleware.swaggerValidator() does not validate nested definition.

whitlockjc commented 6 years ago

Do you have a reproduction recipe? There is very little to go on here.

JaekwanLee commented 6 years ago

Sorry, there was a flaw in the swagger.json I was using.