Skip to content
Snippets Groups Projects
Commit f95d7c19 authored by julian.baeume's avatar julian.baeume :pick:
Browse files

change API for manifests and dependencies

remove /api prefix and be more restful. This should help to simplify ingress objects
parent f3f13d72
No related branches found
No related tags found
No related merge requests found
...@@ -41,13 +41,13 @@ describe('Manifest service', () => { ...@@ -41,13 +41,13 @@ describe('Manifest service', () => {
}) })
it('fetches manifest data', async () => { 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.statusCode).toBe(200)
expect(response.body).toEqual([{ namespace: 'test', path: 'example' }]) expect(response.body).toEqual([{ namespace: 'test', path: 'example' }])
}) })
it('caches manifest data', async () => { 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.statusCode).toBe(200)
expect(response.body).toEqual([{ namespace: 'test', path: 'example' }]) expect(response.body).toEqual([{ namespace: 'test', path: 'example' }])
...@@ -59,7 +59,7 @@ describe('Manifest service', () => { ...@@ -59,7 +59,7 @@ describe('Manifest service', () => {
await new Promise(resolve => setTimeout(resolve, 150)) 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.statusCode).toBe(200)
expect(response2.body).toEqual([{ namespace: 'test', path: 'example' }]) expect(response2.body).toEqual([{ namespace: 'test', path: 'example' }])
}) })
...@@ -68,7 +68,7 @@ describe('Manifest service', () => { ...@@ -68,7 +68,7 @@ describe('Manifest service', () => {
process.env.CACHE_TTL = 1 process.env.CACHE_TTL = 1
app = createApp() 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.statusCode).toBe(200)
expect(response.body).toEqual([{ namespace: 'test', path: 'example' }]) expect(response.body).toEqual([{ namespace: 'test', path: 'example' }])
...@@ -81,7 +81,7 @@ describe('Manifest service', () => { ...@@ -81,7 +81,7 @@ describe('Manifest service', () => {
// wait some time // wait some time
await new Promise(resolve => setTimeout(resolve, 10)) 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.statusCode).toBe(200)
expect(response2.body).toEqual([{ namespace: 'other', path: 'example' }]) expect(response2.body).toEqual([{ namespace: 'other', path: 'example' }])
}) })
...@@ -104,7 +104,7 @@ describe('Manifest service', () => { ...@@ -104,7 +104,7 @@ describe('Manifest service', () => {
const app = createApp() const app = createApp()
await request(app) await request(app)
.get('/api/manifest.json') .get('/manifests')
.then(response => { .then(response => {
expect(response.statusCode).toBe(200) expect(response.statusCode).toBe(200)
expect(response.body).toEqual([ expect(response.body).toEqual([
......
...@@ -62,7 +62,7 @@ export function createApp () { ...@@ -62,7 +62,7 @@ export function createApp () {
app.use('/swagger.json', (req, res) => res.json(swaggerDocument)) app.use('/swagger.json', (req, res) => res.json(swaggerDocument))
app.timeout = 30000 app.timeout = 30000
app.get('/api/manifest.json', async (req, res, next) => { app.get('/manifests', async (req, res, next) => {
try { try {
res.json(await getOxManifests()) res.json(await getOxManifests())
} catch (err) { } catch (err) {
...@@ -70,7 +70,7 @@ export function createApp () { ...@@ -70,7 +70,7 @@ export function createApp () {
} }
}) })
app.get('/api/deps.json', async (req, res, next) => { app.get('/dependencies', async (req, res, next) => {
try { try {
res.json(await getDependencies()) res.json(await getDependencies())
} catch (err) { } catch (err) {
......
...@@ -4,12 +4,12 @@ info: ...@@ -4,12 +4,12 @@ info:
version: 1.0.0 version: 1.0.0
description: Micro service that collects manifest files from different services and merge them into a single file description: Micro service that collects manifest files from different services and merge them into a single file
paths: paths:
/api/manifest.json: /manifests:
get: get:
summary: Returns merged manifest.json summary: App Suite UI compatible version of manifests data
responses: responses:
'200': '200':
description: manifest.json file description: manifests data in JSON format
content: content:
application/json: application/json:
schema: schema:
...@@ -41,6 +41,18 @@ paths: ...@@ -41,6 +41,18 @@ paths:
device: device:
type: string type: string
example: '!smartphone' 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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment