http-spec icon indicating copy to clipboard operation
http-spec copied to clipboard

Invalid Schema Data Improvements

Open XVincentX opened this issue 4 years ago • 0 comments

We are transforming user input, we cannot assume the data property will actually be a Schema without doing some validation on it somewhere in the code.

Because of this, we're putting guards as isObject although the type should already guarantee that.

  • https://github.com/stoplightio/http-spec/blob/master/src/oas2/transformers/getExamplesFromSchema.ts#L5
  • https://github.com/stoplightio/http-spec/blob/master/src/oas2/transformers/responses.ts#L22
  • https://github.com/stoplightio/http-spec/blob/f2f0acb3ca2957223aff2f805781fe202df314dc/src/oas2/transformers/params.ts#L80

Reference: https://github.com/stoplightio/http-spec/pull/106#issuecomment-660117117

XVincentX avatar Jul 17 '20 16:07 XVincentX