Skip to main content

Y# Schema reference

This document outlines a general structure and explains the default fields of the provided Variant services YAML file and the core default properties found in those types.

Schema

Implementations

This array is only found in the Startup.yaml and is used for adding global scope type dependencies. e.g. ILokiInitialisation, IAdditionalSecureSettings, IAdditionalSettings, etc.

KeyTypeRequiredDescription
namestringYesThe name of the dependency
interfacestringYesThe full assembly name of the interface
implementationstringYesThe full assembly name of the implementation
values:objectNoAny values the implmentations requires

Example

implementations:
  - name: community
    interface: Variant.Core.IAdditionalSecureSettings, Variant.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
    implementation: Variant.Strategies.Azure.Vault.AzureVaultUsingClientCertificate, Variant.Strategies.Azure.Vault, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
    values:
      CacheValues: false
      ClientId: $[Workbench.Vault.ClientId]
      TenantId: $[Workbench.Vault.TenantId]
      Thumbprint: $[Workbench.Vault.Thumbprint]
      VaultUrl: $[Workbench.Vault.Url]

EndPoints

This array holds the definitions of all the endpoints the application exposes.

KeyTypeRequiredDescription
routeTemplatestringYesThe URL path for the endpoint. It can include path parameters encapsulated by \{xxx} (use {*xxx} to grab the following path in full). These values are accessed by the following notation: '${Request.Path.xxxx}
routeOpenApiobjectNoThis allows the full OpenApi specification for this endpoint to be defined. For full details see the OpenApi specifications for the schema you have defined in the /openapi.json endpoint call
routeMethodstringYesThe HTTP method for the endpoint. Allowed values are GET, POST, PUT, PATCH, HEAD, DELETE & OPTIONS.
descriptionstringNoA brief description of the endpoint's purpose.
responseOpenApi responseNoMatches the OpenApi response format
queriesobjectNoDefines the expected query parameters. These values are accessed by the following notation: '${Request.Query.xxxx}
headersobjectNoDefines the expected request headers. These values are accessed by the following notation: '${Request.Header.xxxx}
requestobjectNoDefines the expected request body.
pipelinearrayYesAn array of pipes which get executed in sequence. Each item in the array should correspond to a pipe defined in the pipes collection.

'Object' type above corresponds to properties written as:

headers:
name: string (Required)
mobile?: string (Optional)
age: number (Required)

End point example

endPoints:
  - routeTemplate: api/bankholiday/{region}
    routeMethod: GET
    routeOpenApi:
      tags: [ Default ]
      summary: Get bank holidays for a region
      parameters:
        - name: region
          in: path
          required: true
          schema:
            type: string
            enum:
              - england-and-wales
              - scotland
              - northern-ireland      
      responses:
        200: ${Defaults.Ok}
    pipeline:
      - pipe: Variant.Core.Simple.HttpPushPipe
        NAMESPACE: BankHolidays
        HTTP_URL: https://www.gov.uk/bank-holidays.json
        HTTP_METHOD: GET
        CACHE_STRATEGY!: 
          strategy: Variant.Core.InMemoryCacheStrategy     
          CACHE_FOR_TIME_SPAN: 00:00:10      

      - pipe: Variant.Core.Simple.TryCatchAndReplaceScopedPipe
        EXCEPTION_PIPES: 
          - pipe: Variant.Core.ThrowNotFoundBreakPipe
            BLOCKED_WITH_ERROR_MESSAGE: Path region '${Request.Path.region}' not found!
        SCOPED_PIPES: 
          - pipe: Variant.Core.SetResponse
            RESPONSE: ${BankHolidays.${Request.Path.region}.events}

Connections

This array holds the definitions of all the connectors that runs in the application

KeyTypeRequiredDescription
connectorstringYesThe name of the connector whose key is found in the connectors array.
replacementsobjectNoThe values that should be used to replace placeholders in the connector.
defaultsobjectNoAn object of default values and configurations for the connector.
pipelinearrayYesAn array of pipes which get executed in sequence. Each item in the array should correspond to a pipe defined in the pipes collection.

Example

connections:
  - connector: Variant.Core.TimerConnector
    DUE_TIME: 0:0:01
    POLLING_INTERVAL: 00:00:05
    pipeline:
- pipe: Variant.Core.LogDebugMessage
      LOG_MESSAGE: Timer ran at '{Time}'
      LOG_MESSAGE_PARAMETERS: ${DateTimeOffset.Now}

Connectors

This array holds a list of specialised templated connections that can be used in the connections section.

KeyTypeRequiredDescription
keystringYesThe unique identifier of the connector.
valueobjectYesThe details about the connector. Can be a either a specialised connector or a root connector. Root connectors are auto generated from it's underlying Dot Net object are are not editable.

The value object schema:

Core connector

KeyTypeRequiredDescription
typestringYesFully qualified assembly name of the connector
replacementsobjectNoThe values that should be used to replace placeholders in the connector.
defaultsobjectNoAn object of default values and configurations for the connector.
metaDataobjectYesContains details regarding settings, default values etc.

Example

connectors:
  - key: Variant.Core.TimerConnector
    value:
      type:  Variant.Strategies.Core.TimerConnector, Variant.Strategies.Core, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null
      replacements:
        IS_ENABLED: 
        DEFAULTS: 
        CONNECTOR_INSTANCE_NAME: 
        ACTIVITY_NAME: 
        DUE_TIME: "0:0:01"
        IGNORE_EVENT_IF_PROCESSING: True
        POLLING_INTERVAL: "00:00:15"
      # Properties
      DueTime: DUE_TIME
      IgnoreEventIfProcessing: IGNORE_EVENT_IF_PROCESSING
      PollingInterval: POLLING_INTERVAL
      IsEnabled: IS_ENABLED
      Defaults: DEFAULTS
      InstanceName: CONNECTOR_INSTANCE_NAME
      ActivityName: ACTIVITY_NAME
      SerializationHints: SERIALIZATION_HINTS
    metaData:
      id: Variant.Strategies.Core.TimerConnector, Variant.Strategies.Core, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null
      softType: connector
      description:  ""
      tags: ""
      isObsolete: False
      settings:
        - property: IS_ENABLED
          description: "Expression which determines if connector is built. Null == true"
          isRequired: False
          type: System.String
        ### Other properties removed for brevity

Specialised connector

KeyTypeRequiredDescription
connectorstringYesThe name of the connector.
replacementsobjectNoThe values that should be used to replace placeholders in the connector.
defaultsobjectNoAn object of default values and configurations for the connector.

Example

connectors:
  - key: Variant.Azure.Storage.Rest.Queue.TimerConnector
    value:
      connector: Variant.Core.TimerConnector
      replacements:
        DEFAULTS: 
        ACTIVITY_NAME: 
        DUE_TIME: 0:0:01
        POLLING_INTERVAL: 00:00:15
        STORAGE_ACCOUNT_NAME: 
        QUEUE_AUTHORIZATION_PIPE:         
        QUEUE_NAME: 
        QUEUE_NUM_OF_MESSAGES: 32
        QUEUE_BATCH_SIZE: 8
        QUEUE_VISIBILITY_TIMEOUT_IN_SECONDS: 30
        QUEUE_MAX_DEQUEUE_COUNT: 2
        QUEUE_ITEM_NS: QueueItem
        QUEUE_ON_ERROR_HIDE_MESSAGE_FOR_N_SECONDS: 5
        QUEUE_DEAD_LETTER_PIPES: []
        QUEUE_PROCESS_PIPES: |2
                # Set Request header 
              - pipe: Variant.Core.Simple.ModifyMessageStrategyPipe
                NAMESPACE: Request
                VALUE: ${QueueItem.MessageText.ConvertBase64ToString().ConvertStringToJToken()} 
      defaults: 
        IGNORE_EVENT_IF_PROCESSING: True
        IS_ENABLED:
        INSTANCE_NAME: 
      pipeline:
        - pipe: Variant.Azure.Storage.Rest.Queue.ForEachAsyncPipe
          QUEUE_LOG_LEVEL: Trace

Pipes

This array holds the definitions of all the pipes used in the application. See Variant Core pipes for list of values the can be placed in the replacements or defaults properties.

KeyTypeRequiredDescription
keystringYesThe unique identifier of the pipe.
valueobjectYesThe details about the pipe. Can be a either a specialised pipe or a root pipe. Root pipes are auto generated from it's underlying Dot Net object are are not editable.

The value object schema:

Core pipe

Core pipes are auto generated directly from the their c# implementation and will always be found in extension packages and never directly in a service.

KeyTypeRequiredDescription
typestringYesFully qualified assembly name of the pipe
replacementsobjectNoThe values that should be used to replace placeholders in the pipe.
defaultsobjectNoAn object of default values and configurations for the pipe.
metaDataobjectYesContains details regarding settings, default values etc.

Example

pipes:
  - key: Variant.Core.PushMessagePipe
    value:
      type:  Variant.Strategies.Core.PushMessagePipe, Variant.Strategies.Core, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null
      replacements:
        PUSH_MESSAGE_STRATEGY: 
        CAN_EXECUTE_STRATEGY: 
        EXECUTION_FLOW_STRATEGY: 
        CAN_EXECUTE_EXPRESSION: 
        INSTANCE_NAME: 
        ACTIVITY_NAME: 
        IS_ENABLED: 
        CONTINUATION_POLICY: Default # [ Default | ReturnIfExecuted | ContinueOnNotExecuted | ContinueOnError | ReturnOnSuccess | ReturnIfNotExecuted ]
        CONTINUE_ON_ERROR_EXCEPTION_NS: Exception
      # Properties
      PushMessageStrategy: PUSH_MESSAGE_STRATEGY
      CanExecuteStrategy: CAN_EXECUTE_STRATEGY
      CanExecuteExpression: CAN_EXECUTE_EXPRESSION
      ContinuationPolicy: CONTINUATION_POLICY
      ExecutionFlowStrategy: EXECUTION_FLOW_STRATEGY
      ContinueOnErrorExceptionNs: CONTINUE_ON_ERROR_EXCEPTION_NS
      InstanceName: INSTANCE_NAME
      ActivityName: ACTIVITY_NAME
      IsEnabled: IS_ENABLED
      SerializationHints: SERIALIZATION_HINTS
    metaData:
      id: Variant.Strategies.Core.PushMessagePipe, Variant.Strategies.Core, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null
      softType: pipe
      description:  ""
      tags: ""
      isObsolete: False
      settings:
        - property: PUSH_MESSAGE_STRATEGY
          description: "Injected class for pushing a UniteMessage"
          isRequired: True
          type: Variant.Strategies.Core.IPushMessageStrategy
          defaultValue: ""
        - property: CAN_EXECUTE_STRATEGY
          description: "Allows for more complex filtering"
        # Properties removed for brevity

Specialised pipe

Specialised pipes always derive from core pipes and can be found in both extension packages and with service files.

KeyTypeRequiredDescription
pipestringYesThe name of the pipe.
replacementsobjectNoThe values that should be used to replace placeholders in the pipe.
defaultsobjectNoAn object of default values and configurations for the pipe.

Example

pipes:
  - key: Variant.Core.HttpPushMessageStrategyPipe
    value:
      pipe: Variant.Core.PushMessagePipe
      replacements:
        # Pipe replacements
        CAN_EXECUTE_EXPRESSION: null
        CAN_EXECUTE_STRATEGY: null
        CONTINUATION_POLICY: Default
        # Strategy replacements
        CACHE_STRATEGY: 
        RETRY_STRATEGY: 
        HTTP_BODY: 
        HTTP_DATA_HEADER: 
        HTTP_CONTENT_HEADERS: 
        HTTP_RESPONSE_ID: 
        JSON_PARSE_PATH: 
        HTTP_URL: "http://localhost:9012"
        HTTP_LOG_LEVEL: Debug # [ Trace | Debug | Information | Warning | Error | Critical | None ]
        ADD_HEADER_IF_NULL_OR_WHITESPACE: False
        HTTP_HEADERS: |2-
          Content-Type: application/json; charset=utf-8
          Accept: application/json
        HTTP_METHOD: GET
        HTTP_RESPONSE_CONTENT_HEADER:  # Response.ContentHeaders
        HTTP_RESPONSE_HEADER:  # Response.Headers
        HTTP_READ_AS: JToken # [ Stream | String | JToken | HttpResponseMessage ]
        NAMESPACE: Response
        HTTP_TIMEOUT: 60000
        SET_STATUS_CODE_HEADER: False
        HTTP_ALLOW_AUTO_DIRECTS: False
      defaults:
        LOG_ERRORS: True
        ACTIVITY_NAME: 
        EXECUTION_FLOW_STRATEGY: null
        PUSH_MESSAGE_STRATEGY:
          strategy: Variant.Core.HttpPushMessageStrategy

Strategies

This array holds the definitions of all the strategies used in the application.

KeyTypeRequiredDescription
keystringYesThe unique identifier of the strategy.
valueobjectYesThe details about the strategy. Can be a either a specialised strategy or a root strategy. Root strategies are auto generated from it's underlying Dot Net object are are not editable.

The value object schema:

Core strategy

Core strategies are auto generated directly from the their c# implementation and will always be found in extension packages and never directly in a service.

KeyTypeRequiredDescription
typestringYesFully qualified assembly name of the strategy
replacementsobjectNoThe values that should be used to replace placeholders in the strategy.
defaultsobjectNoAn object of default values and configurations for the strategy.
metaDataobjectYesContains details regarding settings, default values etc.

Example

strategies:
 - key: Variant.Core.HttpPushMessage2Strategy
    value:
      type:  Variant.Strategies.Core.HttpPushMessage2Strategy, Variant.Strategies.Core, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null
      replacements:
        CACHE_STRATEGY: 
        RETRY_STRATEGY: 
        HTTP_BODY: 
        HTTP_DATA_HEADER: 
        HTTP_CONTENT_HEADERS: 
        HTTP_RESPONSE_ID: 
        JSON_PARSE_PATH: 
        INSTANCE_NAME: 
        HTTP_URL: "http://localhost:9012"
        HTTP_LOG_LEVEL: Debug # [ Trace | Debug | Information | Warning | Error | Critical | None ]
        ADD_HEADER_IF_NULL_OR_WHITESPACE: False
        HTTP_HEADERS: |2-
          Content-Type: application/json; charset=utf-8
          Accept: application/json
        HTTP_METHOD: GET
        HTTP_RESPONSE_CONTENT_HEADER:  # Response.ContentHeaders
        HTTP_RESPONSE_HEADER:  # Response.Headers
        HTTP_READ_AS: JToken # [ Stream | String | JToken | HttpResponseMessage ]
        NAMESPACE: Response
        HTTP_TIMEOUT: 60000
        SET_STATUS_CODE_HEADER: False
        HTTP_ALLOW_AUTO_DIRECTS: False
        LOG_ERRORS: True
      # Properties
      CacheStrategy: CACHE_STRATEGY
      Url: HTTP_URL
      Body: HTTP_BODY
      DataHeader: HTTP_DATA_HEADER
      HttpLogLevel: HTTP_LOG_LEVEL
      AddHeaderIfNullOrWhiteSpace: ADD_HEADER_IF_NULL_OR_WHITESPACE
      Headers: HTTP_HEADERS
      ContentHeaders: HTTP_CONTENT_HEADERS
      Method: HTTP_METHOD
      RetryStrategy: RETRY_STRATEGY
      HttpResponseContentHeader: HTTP_RESPONSE_CONTENT_HEADER
      HttpResponseHeader: HTTP_RESPONSE_HEADER
      HttpResponseId: HTTP_RESPONSE_ID
      ReadAs: HTTP_READ_AS
      JsonParsePath: JSON_PARSE_PATH
      Namespace: NAMESPACE
      Timeout: HTTP_TIMEOUT
      SetStatusCodeHeader: SET_STATUS_CODE_HEADER
      AllowAutoDirects: HTTP_ALLOW_AUTO_DIRECTS
      InstanceName: INSTANCE_NAME
      LogErrors: LOG_ERRORS
      SerializationHints: SERIALIZATION_HINTS
    metaData:
      id: Variant.Strategies.Core.HttpPushMessage2Strategy, Variant.Strategies.Core, Version=1.1.0.0, Culture=neutral, PublicKeyToken=null
      softType: strategy
      description:  ""
      tags: ""
      isObsolete: False
      settings:
        - property: CACHE_STRATEGY
          description: "Cache strategy"
          isRequired: False
          type: Variant.Strategies.Core.ICacheStrategy
          defaultValue: ""
        # Additional properties removed for brevity

Specialised strategy

Specialised strategies always derive from core strategies and can be found in both extension packages and with service files.

KeyTypeRequiredDescription
strategystringYesThe name of the strategy.
replacementsobjectNoThe values that should be used to replace placeholders in the strategy.
defaultsobjectNoAn object of default values and configurations for the strategy.

Example

As strategies need to be instantiated with a pipe we can use a simplified http pipe for calling http endpoints

strategies:
  - key: Variant.Core.Simple.HttpPushPipe
    value:
      pipe: Variant.Core.HttpPushMessage2StrategyPipe
      replacements:
        NAMESPACE: Response
        HTTP_URL: 
        HTTP_METHOD: GET
        HTTP_READ_AS: JToken
        HTTP_HEADERS: |2-

              Content-Type: application/json; charset=utf-8
              Accept: application/json
        HTTP_BODY:

Variant Core Pipes

There are 3 different pipe definitions / types:

  • VariantPipe: All pipes are themselves derived from this pipe
  • VariantConditionalPipe: Adds conditional processing to the VariantPipe
  • VariantScopedConditionalPipe: A pipe that has a collection of child pipes. Itself is derived from VariantConditionalPipe.

All of the keys below can be placed under the replacements or defaults property of its pipe.

Note: All pipes when executed return either: Success, NotExecuted or Failed.

Variant Pipe

KeyTypeRequiredDescription
INSTANCE_NAMEstringNoA description that is used when logging or throwing errors. If not present then a the name of the type will be used instead.
LOG_ERRORSboolYesWhen implemented and true, the pipe should not write any errors to the logging system

Variant Conditional Pipe

Derived from VariantPipe and includes includes all the properties that that exposes.

KeyTypeRequiredDescription
CAN_EXECUTE_EXPRESSIONstringNoThe unique identifier of the strategy. e.g. "${MyValue}" == true
CAN_EXECUTE_STRATEGYstrategyNoA strategy that is derived from the ICanExecuteStrategy interface. Allows for a more business specific run conditions.
EXECUTION_FLOW_STRATEGYstrategyNoProvides a granular approach for return values: outcome, error message & error id dependent on the ContinuationPolicy.
CONTINUATION_POLICYContinuationPolicyNoDetermines execution flow dependent on pipe result

Variant Conditional Scoped Pipe

Derived from VariantConditionalPipe and includes includes all the properties that that exposes.

KeyTypeRequiredDescription
SCOPED_PIPESarrayYesA list of pipes to execute.

ContinuationPolicy

KeyTypeDescription
DefaultstringExecution continues unless there are errors. On an error the pipeline execution stops at that pipe line
ReturnIfExecutedstringIf the pipe runs then no other peer pipes are executed in the pipeline
ReturnIfNotExecutedstringIf the pipe is not executed then no other peer pipes are executed in the pipeline
ReturnOnSuccessstringStops execution of any further pipes in the pipeline if the pipe was successful. i.e. Outcome != Failed
ContinueOnNotExecutedstringAllows continuation when pipe execution returns NotExecuted.
ContinueOnErrorstringContinues onto the next pipe even if the pipe errored.