Skip to content

Refactor external references #691

Closed
Closed
@cdavernas

Description

@cdavernas

What would you like to be added:

Refactor external references.

What I propose is:

  1. To define a resource object, such as the following, used to encapsulate external definitions:
auth:
  - name: foo_basic
    scheme: basic
    properties:
      username: username
      password: password
functions:
  - name: secured_function
    type: rest
    operation: https://foo.bar#baz
    authRef: foo_basic

In other words, an external function definition file would not contain an array of function definitions, but an object such as the above.

In addition, that would allow serverless-workflow compatible apps to provide a self-describing document making it ready to use in Serverless Workflow.

  1. Instead of having functions, events, etc. be of type oneOf<uri, functionArray>, they should be only of type array, as discussed in the meeting of the 27th of September, and in Function definition namespaces (Importing several function definition files) #676.
    A new imports (or resources) top-level properties would replace the need for uri-values, and would allow the import of multiple files instead of just one.
name: foobar
version: 0.1.0
specVersion: 0.9
imports:
  - namespace: foo
    uri: https://foobar.baz/sw.res
  - namespace: bar
    uri: https://bazfoo.bar/sw.res
states:
  - name: invoke_external_functions
    type: operation
    actions:
      - name: invoke_foo
        functionRef:
          refName: foo.greet
          arguments:
            greetings: Hello, Serverless Workflow!
     - name: invoke_bar
        functionRef:
          refName: bar.greet
          arguments:
            greetings: Hello, dear readers!
    end: true

Why is this needed:

Currently, external references are easy and simple to use, but unhappilly do not address all common/reasonnable use cases, as explained in #676. In addition, it forbids referencing in a safe manner external functions that define an authRef

Metadata

Metadata

Assignees

Labels

area: specChanges in the Specificationchange: featureNew feature or request. Impacts in a minor version change

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions