fix: default missing type to any type #90
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Primarily this is to fix the TypeError that is thrown if a parameter
is missing any type information. Such an error makes it hard to debug
your spec:
Per the spec if no type is given then the type defaults 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 parameter 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.
Fixes #89