Forum Discussion

exuraz's avatar
New Contributor
6 years ago

Required list has not defined properties: ['type']



Generating a python-flask server stub for OpenTripModel (using OAS 3) works but when trying to run the server gives the following error:

Traceback (most recent call last):
File "c:\python37\Lib\", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\python37\Lib\", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\Julian\Downloads\server\openapi_server\", line 18, in <module>
File "C:\Users\Julian\Downloads\server\openapi_server\", line 13, in main
File "C:\Users\Julian\.virtualenvs\server-Cq-s3KBS\lib\site-packages\connexion\apps\", line 54, in add_api
api = super(FlaskApp, self).add_api(specification, **kwargs)
File "C:\Users\Julian\.virtualenvs\server-Cq-s3KBS\lib\site-packages\connexion\apps\", line 155, in add_api
File "C:\Users\Julian\.virtualenvs\server-Cq-s3KBS\lib\site-packages\connexion\apis\", line 73, in __init__
self.specification = Specification.load(specification, arguments=arguments)
File "C:\Users\Julian\.virtualenvs\server-Cq-s3KBS\lib\site-packages\connexion\", line 151, in load
return cls.from_file(spec, arguments=arguments)
File "C:\Users\Julian\.virtualenvs\server-Cq-s3KBS\lib\site-packages\connexion\", line 108, in from_file
return cls.from_dict(spec)
File "C:\Users\Julian\.virtualenvs\server-Cq-s3KBS\lib\site-packages\connexion\", line 146, in from_dict
return OpenAPISpecification(spec)
File "C:\Users\Julian\.virtualenvs\server-Cq-s3KBS\lib\site-packages\connexion\", line 39, in __init__
File "C:\Users\Julian\.virtualenvs\server-Cq-s3KBS\lib\site-packages\connexion\", line 232, in _validate_spec
raise InvalidSpecification.create_from(e)
connexion.exceptions.InvalidSpecification: Required list has not defined properties: ['type']

There is no indication to where this error occurs in the swagger.yaml file so I have no idea how to fix this.

Swagger Editor and SwaggerHub both say the spec is valid, however running openapi-spec-validator returns the same error regarding Required list has not defined properties: ['type'], but does not give a location for that error either.


Is there any way to find this out?

4 Replies

      • HKosova's avatar
        SmartBear Alumni (Retired)
        exuraz wrote:


        It turned out the file has errors which are not detected by a lot of validators.

        I found an OpenAPI validator from IBM which does see them and gives line numbers to fix them:

        From a quick look the file seems to be a valid OpenAPI 3.0 definition. Most (if not all) errors and warnings reported by IBM's openapi-validator are NOT syntax errors but custom style validations based on "custom IBM-defined best practices" such as:

        Property names must be lower snake case.

        Arrays MUST NOT be returned as the top-level structure in a response body.
        Operations with non-form request bodies should set a name with the x-codegen-request-body-name annotation.

        These things aren't actually errors.