diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b75617..55a7bd3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/). ### Added - OpenAPI documents can now have `externalDocs` object provided through `@OpenAPI.externalDocs` annotation in the service level of CDS. +- OpenAPI documents now throws warning if `securitySchemas` are not found. ## Version 1.0.6 - 23.09.2024 diff --git a/lib/compile/csdl2openapi.js b/lib/compile/csdl2openapi.js index 0dcbcc2..3cacb3a 100644 --- a/lib/compile/csdl2openapi.js +++ b/lib/compile/csdl2openapi.js @@ -2432,6 +2432,10 @@ see [Expand](http://docs.oasis-open.org/odata/odata/v4.01/odata-v4.01-part1-prot */ function security(openapi, entityContainer) { const securitySchemes = entityContainer && entityContainer[voc.Authorization.SecuritySchemes] ? entityContainer[voc.Authorization.SecuritySchemes] : []; + // check if securitySchemas exist if it does not exist then throw a warning + if (securitySchemes.length === 0) { + console.warn('No security schemes defined in the entity container'); + } if (securitySchemes.length > 0) openapi.security = []; securitySchemes.forEach(scheme => { const s = {};