Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
browser/swagger-client.js: Throw errors for null types
Avoid 'too much recursion' errors with properties like: "species": { "type": "string", "enum": [ null, "cat", "dog" ] } The JSON Schema spec says for enums [1]: > Elements in the array MAY be of any type, including null. But they aren't supported by Swagger 2.0, because null isn't one of Swagger 2's types [2,3]. This commit gives a more obvious hint about that. It would be nice to have clarification in the spec so we could link to tidier docs than the GitHub issue too [2]. It would be nice if I could point to line numbers (or the chain of keys?) to find the broken entry in the parsed spec, but it doesn't seem like that information is available in resolveAllOf and I'm not clear enough on the larger picture here to know where that would plug in. [1]: http://json-schema.org/latest/json-schema-validation.html#anchor77 [2]: OAI/OpenAPI-Specification#229 (comment) [3]: https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md#data-types
- Loading branch information