-
Notifications
You must be signed in to change notification settings - Fork 19
Description
Describe the bug
Building an OAS2 spec against vSphere vCenter 8.0u3 results in vcenter.json that does not pass OAS2 validation.
For example, Swagger-cli reports:
Swagger schema validation failed.
#/basePath must match pattern "^/"
#/paths/~1api~1vcenter~1authentication~1token/post/parameters/0 must have required property 'schema'
#/paths/~1api~1vcenter~1authentication~1token/post/parameters/0 must NOT have additional properties
#/paths/~1api~1vcenter~1authentication~1token/post/parameters/0/in must be equal to one of the allowed values
#/paths/~1api~1vcenter~1authentication~1token/post/parameters/0/required must be boolean
#/paths/~1api~1vcenter~1authentication~1token/post/parameters/0/required must be boolean
#/paths/~1api~1vcenter~1authentication~1token/post/parameters/0/in must be equal to one of the allowed values
#/paths/~1api~1vcenter~1authentication~1token/post/parameters/0/required must be boolean
#/paths/~1api~1vcenter~1authentication~1token/post/parameters/0/required must be boolean
#/paths/~1api~1vcenter~1authentication~1token/post/parameters/0/in must be equal to one of the allowed values
#/paths/~1api~1vcenter~1authentication~1token/post/parameters/0/required must be boolean
#/paths/~1api~1vcenter~1authentication~1token/post/parameters/0/required must be equal to one of the allowed values
#/paths/~1api~1vcenter~1authentication~1token/post/parameters/0/in must be equal to one of the allowed values
#/paths/~1api~1vcenter~1authentication~1token/post/parameters/0 must match exactly one schema in oneOf
#/paths/~1api~1vcenter~1authentication~1token/post/parameters/0 must match exactly one schema in oneOf
#/paths/~1api~1vcenter~1authentication~1token/post/parameters/0 must have required property '$ref'
#/paths/~1api~1vcenter~1authentication~1token/post/parameters/0 must NOT have additional properties
#/paths/~1api~1vcenter~1authentication~1token/post/parameters/0 must NOT have additional properties
#/paths/~1api~1vcenter~1authentication~1token/post/parameters/0 must NOT have additional properties
#/paths/~1api~1vcenter~1authentication~1token/post/parameters/0 must NOT have additional properties
#/paths/~1api~1vcenter~1authentication~1token/post/parameters/0 must NOT have additional properties
#/paths/~1api~1vcenter~1authentication~1token/post/parameters/0 must match exactly one schema in oneOf
Analysis shows that formData mandatory parameter of POST /api/vcenter/authentication/token has field "required":"true" instead of "required":true.
The root cause appears to be:
vmware-openapi-generator/lib/api_endpoint/swagger2/api_swagger_parameter_handler.py
Line 125 in 54cf631
| formDataEntry["required"] = "true"; |
Similar mistype is observed also here:
vmware-openapi-generator/lib/api_endpoint/swagger2/api_swagger_parameter_handler.py
Line 95 in 54cf631
| elif parameter_obj['required'] == 'true': |
(Edited: updated to correct parameter type and suspected code line)
Reproduction steps
python vmsgen.py -vc <vcenter-8.0u3-host -oas 2 -o generatedswagger-cli validate generated/vcenter.json
Expected behavior
Required mandatory parameters should result in a valid OAS2 spec.
Additional context
No response