open-api icon indicating copy to clipboard operation
open-api copied to clipboard

Incorrect type for componentSchemas in OpenAPIRequestValidator

Open aldex32 opened this issue 2 years ago • 4 comments

Hello,

the componentSchemas field in OpenAPIRequestValidator is declared as:

componentSchemas?: IJsonSchema[];

But looking to the tests, you are always passing an object instead of an array. When I pass an object it works fine, but if I pass the schemas as array it fails to resolve references, with an error like:

Error: can't resolve reference #/components/schemas/TestItem from id #

Is it an idea to change the type to something like:

componentSchemas?: {[key: string]: OpenAPIV3.ReferenceObject | OpenAPIV3.SchemaObject;}

aldex32 avatar Jul 06 '22 11:07 aldex32

Hi @jsdevel , perhaps you have an opinion?

aldex32 avatar Jul 06 '22 14:07 aldex32

not really sure. if you feel the current types are out of sync with the OAI spec, please open a PR.

jsdevel avatar Jul 06 '22 18:07 jsdevel

Maybe also @mbsimonovic , I see you have contributed in adding componentSchemas for OAS v3, could you perhaps have a look to this issue and the PR I created?

aldex32 avatar Jul 08 '22 16:07 aldex32

ah this was years ago, i havent used kogos since

mbsimonovic avatar Jul 08 '22 17:07 mbsimonovic