Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* open-api addon controller * bug fixes * bug fixes * resolve merge conflict * bug fix * bug fix * bug fix * PR comments * PR comments * Resolve merge conflics * Resolve merge conflics * bug and tests
- Loading branch information
1 parent
b3320bf
commit 66452e2
Showing
14 changed files
with
641 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
spec: | ||
name: unleash | ||
services: | ||
- name: unleash-server | ||
git: | ||
branch: main | ||
repo_clone_url: https://github.com/Unleash/unleash.git | ||
build_command: 'yarn build' | ||
run_command: 'yarn start' | ||
envs: | ||
- key: DATABASE_URL | ||
scope: RUN_TIME | ||
value: ${unleash-db.DATABASE_URL} | ||
- key: UNLEASH_URL | ||
scope: RUN_TIME | ||
value: ${APP_URL} | ||
- name: unleash-server | ||
git: | ||
branch: main | ||
repo_clone_url: https://github.com/Unleash/unleash.git | ||
build_command: 'yarn build' | ||
run_command: 'yarn start' | ||
envs: | ||
- key: DATABASE_URL | ||
scope: RUN_TIME | ||
value: ${unleash-db.DATABASE_URL} | ||
- key: UNLEASH_URL | ||
scope: RUN_TIME | ||
value: ${APP_URL} | ||
databases: | ||
- name: unleash-db | ||
- name: unleash-db |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { FromSchema } from 'json-schema-to-ts'; | ||
|
||
export const addonParameterSchema = { | ||
$id: '#/components/schemas/addonParameterSchema', | ||
type: 'object', | ||
required: ['name', 'displayName', 'type', 'required', 'sensitive'], | ||
properties: { | ||
name: { | ||
type: 'string', | ||
}, | ||
displayName: { | ||
type: 'string', | ||
}, | ||
type: { | ||
type: 'string', | ||
}, | ||
description: { | ||
type: 'string', | ||
}, | ||
placeholder: { | ||
type: 'string', | ||
}, | ||
required: { | ||
type: 'boolean', | ||
}, | ||
sensitive: { | ||
type: 'boolean', | ||
}, | ||
}, | ||
components: {}, | ||
} as const; | ||
|
||
export type AddonParameterSchema = FromSchema<typeof addonParameterSchema>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { validateSchema } from '../validate'; | ||
import { AddonSchema } from './addon-schema'; | ||
|
||
test('addonSchema', () => { | ||
const data: AddonSchema = { | ||
provider: 'some-provider', | ||
enabled: true, | ||
parameters: { | ||
someKey: 'some-value', | ||
}, | ||
events: ['some-event'], | ||
}; | ||
|
||
expect( | ||
validateSchema('#/components/schemas/addonSchema', data), | ||
).toBeUndefined(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { FromSchema } from 'json-schema-to-ts'; | ||
|
||
export const addonSchema = { | ||
$id: '#/components/schemas/addonSchema', | ||
type: 'object', | ||
required: ['provider', 'enabled', 'parameters', 'events'], | ||
properties: { | ||
id: { | ||
type: 'number', | ||
}, | ||
createdAt: { | ||
type: 'string', | ||
format: 'date-time', | ||
nullable: true, | ||
}, | ||
provider: { | ||
type: 'string', | ||
}, | ||
description: { | ||
type: 'string', | ||
}, | ||
enabled: { | ||
type: 'boolean', | ||
}, | ||
parameters: { | ||
type: 'object', | ||
additionalProperties: true, | ||
}, | ||
events: { | ||
type: 'array', | ||
items: { | ||
type: 'string', | ||
}, | ||
}, | ||
}, | ||
components: {}, | ||
} as const; | ||
|
||
export type AddonSchema = FromSchema<typeof addonSchema>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { FromSchema } from 'json-schema-to-ts'; | ||
import { addonParameterSchema } from './addon-parameter-schema'; | ||
import { tagTypeSchema } from './tag-type-schema'; | ||
|
||
export const addonTypeSchema = { | ||
$id: '#/components/schemas/addonTypeSchema', | ||
type: 'object', | ||
required: ['name', 'displayName', 'documentationUrl', 'description'], | ||
properties: { | ||
name: { | ||
type: 'string', | ||
}, | ||
displayName: { | ||
type: 'string', | ||
}, | ||
documentationUrl: { | ||
type: 'string', | ||
}, | ||
description: { | ||
type: 'string', | ||
}, | ||
tagTypes: { | ||
type: 'array', | ||
items: { | ||
$ref: '#/components/schemas/tagTypeSchema', | ||
}, | ||
}, | ||
parameters: { | ||
type: 'array', | ||
items: { | ||
$ref: '#/components/schemas/addonParameterSchema', | ||
}, | ||
}, | ||
events: { | ||
type: 'array', | ||
items: { | ||
type: 'string', | ||
}, | ||
}, | ||
}, | ||
components: { | ||
schemas: { | ||
tagTypeSchema, | ||
addonParameterSchema, | ||
}, | ||
}, | ||
} as const; | ||
|
||
export type AddonTypeSchema = FromSchema<typeof addonTypeSchema>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { validateSchema } from '../validate'; | ||
import { AddonsSchema } from './addons-schema'; | ||
|
||
test('addonsSchema', () => { | ||
const data: AddonsSchema = { | ||
addons: [ | ||
{ | ||
parameters: { someKey: 'some-value' }, | ||
events: ['some-event'], | ||
enabled: true, | ||
provider: 'some-name', | ||
}, | ||
], | ||
providers: [ | ||
{ | ||
name: 'some-name', | ||
displayName: 'some-display-name', | ||
documentationUrl: 'some-url', | ||
description: 'some-description', | ||
parameters: [ | ||
{ | ||
name: 'some-name', | ||
displayName: 'some-display-name', | ||
type: 'some-type', | ||
required: true, | ||
sensitive: true, | ||
}, | ||
], | ||
}, | ||
], | ||
}; | ||
|
||
expect( | ||
validateSchema('#/components/schemas/addonsSchema', data), | ||
).toBeUndefined(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { FromSchema } from 'json-schema-to-ts'; | ||
import { addonSchema } from './addon-schema'; | ||
import { addonTypeSchema } from './addon-type-schema'; | ||
import { addonParameterSchema } from './addon-parameter-schema'; | ||
import { tagTypeSchema } from './tag-type-schema'; | ||
|
||
export const addonsSchema = { | ||
$id: '#/components/schemas/addonsSchema', | ||
type: 'object', | ||
required: ['addons', 'providers'], | ||
properties: { | ||
addons: { | ||
type: 'array', | ||
items: { | ||
$ref: '#/components/schemas/addonSchema', | ||
}, | ||
}, | ||
providers: { | ||
type: 'array', | ||
items: { | ||
$ref: '#/components/schemas/addonTypeSchema', | ||
}, | ||
}, | ||
}, | ||
components: { | ||
schemas: { | ||
addonSchema, | ||
addonTypeSchema, | ||
tagTypeSchema, | ||
addonParameterSchema, | ||
}, | ||
}, | ||
} as const; | ||
|
||
export type AddonsSchema = FromSchema<typeof addonsSchema>; |
Oops, something went wrong.