diff --git a/spec/server_test.js b/spec/server_test.js index ac2daf94a5197651d01fcb00bf737d7cbe7d76fd..541c136a913e8b980738503a671794db8ba3e81c 100644 --- a/spec/server_test.js +++ b/spec/server_test.js @@ -41,13 +41,13 @@ describe('Manifest service', () => { }) it('fetches manifest data', async () => { - const response = await request(app).get('/api/manifest.json') + const response = await request(app).get('/manifests') expect(response.statusCode).toBe(200) expect(response.body).toEqual([{ namespace: 'test', path: 'example' }]) }) it('caches manifest data', async () => { - const response = await request(app).get('/api/manifest.json') + const response = await request(app).get('/manifests') expect(response.statusCode).toBe(200) expect(response.body).toEqual([{ namespace: 'test', path: 'example' }]) @@ -59,7 +59,7 @@ describe('Manifest service', () => { await new Promise(resolve => setTimeout(resolve, 150)) - const response2 = await request(app).get('/api/manifest.json') + const response2 = await request(app).get('/manifests') expect(response2.statusCode).toBe(200) expect(response2.body).toEqual([{ namespace: 'test', path: 'example' }]) }) @@ -68,7 +68,7 @@ describe('Manifest service', () => { process.env.CACHE_TTL = 1 app = createApp() - const response = await request(app).get('/api/manifest.json') + const response = await request(app).get('/manifests') expect(response.statusCode).toBe(200) expect(response.body).toEqual([{ namespace: 'test', path: 'example' }]) @@ -81,7 +81,7 @@ describe('Manifest service', () => { // wait some time await new Promise(resolve => setTimeout(resolve, 10)) - const response2 = await request(app).get('/api/manifest.json') + const response2 = await request(app).get('/manifests') expect(response2.statusCode).toBe(200) expect(response2.body).toEqual([{ namespace: 'other', path: 'example' }]) }) @@ -104,7 +104,7 @@ describe('Manifest service', () => { const app = createApp() await request(app) - .get('/api/manifest.json') + .get('/manifests') .then(response => { expect(response.statusCode).toBe(200) expect(response.body).toEqual([ diff --git a/src/createApp.js b/src/createApp.js index ef282800548e0ee0097bee2f40251e511a2d5aaf..9022ebebd342bd9e0705ef813cca720da01383f4 100644 --- a/src/createApp.js +++ b/src/createApp.js @@ -62,7 +62,7 @@ export function createApp () { app.use('/swagger.json', (req, res) => res.json(swaggerDocument)) app.timeout = 30000 - app.get('/api/manifest.json', async (req, res, next) => { + app.get('/manifests', async (req, res, next) => { try { res.json(await getOxManifests()) } catch (err) { @@ -70,7 +70,7 @@ export function createApp () { } }) - app.get('/api/deps.json', async (req, res, next) => { + app.get('/dependencies', async (req, res, next) => { try { res.json(await getDependencies()) } catch (err) { diff --git a/src/swagger.yaml b/src/swagger.yaml index 8cab3b3eeb7988cfb1f674157e8db53b58195df4..0765cbfb1a849a9dcc98c02e6f3546a05904e070 100644 --- a/src/swagger.yaml +++ b/src/swagger.yaml @@ -4,12 +4,12 @@ info: version: 1.0.0 description: Micro service that collects manifest files from different services and merge them into a single file paths: - /api/manifest.json: + /manifests: get: - summary: Returns merged manifest.json + summary: App Suite UI compatible version of manifests data responses: '200': - description: manifest.json file + description: manifests data in JSON format content: application/json: schema: @@ -41,6 +41,18 @@ paths: device: type: string example: '!smartphone' - - - + /dependencies: + get: + summary: Mapping of all files to all of its dependencies + responses: + '200': + description: dependency information for all files of the manifest + content: + application/json: + schema: + type: object + properties: + dependency: + type: array + items: + type: string