Warn if info.version is omitted, error if info is missing.

This commit is contained in:
Patrick Niklaus 2019-01-17 11:12:02 +01:00
parent 4b302d54dc
commit ad30501c80

View File

@ -63,6 +63,12 @@ export class OpenAPIParser {
if (spec.openapi === undefined) {
throw new Error('Document must be valid OpenAPI 3.0.0 definition');
}
if (spec.info === undefined) {
throw new Error('OpenAPI 3.0.0 requires an `info` section');
}
if (spec.info.version === undefined) {
console.warn('OpenAPI 3.0.0 requires setting a `info.version` field, ignoring.')
}
}
preprocess(spec: OpenAPISpec) {