@terascope/job-components / operations/convict-schema / default
Abstract Class: default<T, S>
Defined in: packages/job-components/src/operations/convict-schema.ts:16
A base class for supporting convict "Schema" definitions
Extends
default<T>
Extended by
Type Parameters
| Type Parameter | Default type |
|---|---|
T extends Record<string, any> | - |
S | any |
Constructors
Constructor
new default<
T,S>(context,opType):ConvictSchema<T,S>
Defined in: packages/job-components/src/operations/convict-schema.ts:21
Parameters
| Parameter | Type | Default value |
|---|---|---|
context | Context | undefined |
opType | OpType | 'operation' |
Returns
ConvictSchema<T, S>
Overrides
Properties
| Property | Modifier | Type | Inherited from | Defined in |
|---|---|---|---|---|
context | protected | Context | default.context | packages/job-components/src/operations/core/schema-core.ts:8 |
opType | readonly | OpType | default.opType | packages/job-components/src/operations/core/schema-core.ts:9 |
schema | public | convict.Schema<S> | - | packages/job-components/src/operations/convict-schema.ts:19 |
Methods
build()
abstractbuild<U>(context?):convict.Schema<S&U>
Defined in: packages/job-components/src/operations/convict-schema.ts:102
Type Parameters
| Type Parameter | Default type |
|---|---|
U | any |
Parameters
| Parameter | Type |
|---|---|
context? | Context |
Returns
convict.Schema<S & U>
Overrides
ensureAPIFromConfig()
ensureAPIFromConfig(
apiName,job,config):void
Defined in: packages/job-components/src/operations/convict-schema.ts:65
This method will make sure that the api exists on the job, if it does not then it will inject it using apiName provided and with the config key/values provided. If the api does exist it will compare the apiConfig against the provided config. If the key/values do not match, then it will throw
Parameters
| Parameter | Type |
|---|---|
apiName | string |
job | ValidatedJobConfig |
config | Record<string, any> |
Returns
void
Example
const job = newTestJobConfig({
operations: [
{ _op: 'test-reader' },
{ _op: 'noop' },
]
});
schema.ensureAPIFromConfig('someApi', job, { some: 'configs' });
job === {
apis: [{ _name: 'someApi', some: 'configs' }],
operations: [
{ _op: 'test-reader' },
{ _op: 'noop' },
]
}
validate()
Call Signature
validate(
inputConfig):APIConfig&T
Defined in: packages/job-components/src/operations/convict-schema.ts:26
Parameters
| Parameter | Type |
|---|---|
inputConfig | Record<string, any> |
Returns
APIConfig & T
Overrides
Call Signature
validate(
inputConfig):OpConfig&T
Defined in: packages/job-components/src/operations/convict-schema.ts:27
Parameters
| Parameter | Type |
|---|---|
inputConfig | Record<string, any> |
Returns
OpConfig & T
Overrides
SchemaCore.validate
validateJob()
validateJob(
_job):void
Defined in: packages/job-components/src/operations/convict-schema.ts:36
Parameters
| Parameter | Type |
|---|---|
_job | ValidatedJobConfig |
Returns
void
Overrides
type()
statictype():string
Defined in: packages/job-components/src/operations/convict-schema.ts:98
Returns
string