Skip to content

Commit

Permalink
feat: Added test for op/definition with jsonPath param (#1539)
Browse files Browse the repository at this point in the history
fixes regression causing op/definition endpoint response failure introduced by index.js refactoring
  • Loading branch information
cd-rite authored Feb 24, 2025
1 parent 48d24e5 commit 0f4d237
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
13 changes: 6 additions & 7 deletions api/source/bootstrap/docs.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,14 @@ function serveDocs(app) {
}

function serveApiDocs(app) {

if (config.swaggerUi.enabled) {
const oasDoc = getOAS()
const oasDoc = getOAS()
if (config.swaggerUi.enabled) {
configureSwaggerUI(app, oasDoc)
}
else
{
}
else
{
logger.writeDebug('serveApiDocs', 'SwaggerUI', { message: 'Swagger UI is disabled in configuration' })
}
}
}

function getOAS(){
Expand Down
14 changes: 14 additions & 0 deletions test/api/mocha/data/operation/op.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,20 @@ describe('GET - Op', () => {
expect(res.status).to.eql(200)
})
})
describe('getDefinition - /op/definition - with jsonPath param', () => {
it('Return API Deployment Definition', async () => {
const res = await utils.executeRequest(`${config.baseUrl}/op/definition?jsonpath=%24.components.schemas.RoleId`, 'GET', iteration.token)
expect(res.status).to.eql(200)
const expectedSchema = [
{
maximum: 4,
minimum: 1,
type: "integer"
}
]
expect(res.body[0]).to.deep.equal(expectedSchema[0])
})
})
})
}
})

0 comments on commit 0f4d237

Please sign in to comment.