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', () => {
})
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([
......
......@@ -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) {
......
......@@ -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
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