You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a parameter is missing a type and also missing schema then a TypeError is thrown:
/openapi-snippet/openapi-to-har.js:441
'SOME_' + (param.type ||param.schema.type).toUpperCase() + '_VALUE';
^
TypeError: Cannot read properties of undefined (reading 'type')
at getParameterValues (/Users/cwelchmi/emu/metasys-rest-api/node_modules/openapi-snippet/openapi-to-har.js:441:43)
the method parseParametersToQuery checks the schema type and if it is undefined then the type is defaulted to object but it should just leave it undefined.
A schema without a type matches any data type – numbers, strings, objects, and so on. {} is shorthand syntax for an arbitrary-type schema
Per the spec if no type is given then the type default to the Any Type:
https://swagger.io/docs/specification/data-models/data-types/#any
This commit removes a check that explicitly sets any undefined
type to object, instead leaving it blank. Then where type checking
is done it adds support not only for missing types, but the explicit
any type expressed as {}.
One existing test was expecting SOME_OBJECT_TYPE because of a missing
type, this test was corrected to look for SOME_ANY_TYPE. Three
additional tests were added to check that no type, {} in param.type, and
{} in param.schema.type were all handled appropriately.
FixesErikWittern#89
Per the spec if no type is given then the type default to the Any Type:
https://swagger.io/docs/specification/data-models/data-types/#any
This commit removes a check that explicitly sets any undefined
type to object, instead leaving it blank. Then where type checking
is done it adds support for missing types.
One existing test was expecting SOME_OBJECT_TYPE because of a missing
type, this test was corrected to look for SOME_ANY_TYPE. An additional
test was added to explicitly state that missing types are to be
considered Any Type.
In addition a fix was made that if the value of a type field is not
a string, then the parmater value SOME_ERROR_TYPE is generated. This
allows the snippet generator to run without error, but presumably
in some workflow the openapi validator will catch the spec error.
FixesErikWittern#89
I'm working on fixes for the following:
If a parameter is missing a
type
and also missingschema
then a TypeError is thrown:the method parseParametersToQuery checks the schema type and if it is undefined then the type is defaulted to
object
but it should just leave it undefined.Quoted from any type
The text was updated successfully, but these errors were encountered: