Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of external resource ("functions", "events", etc) analysis of the specification v0.8 #168

Closed
ribeiromiranda opened this issue Mar 31, 2023 · 2 comments
Labels
question ❓ Further information is requested

Comments

@ribeiromiranda
Copy link
Collaborator

The specification has the definition below which is different from the example:

The functions property can be either an in-line function definition array, or an URI reference to a resource containing an array of functions definition. Referenced resource can be used by multiple workflow definitions.

Especification example

{
   "functions": [
      {
         "name":"HelloWorldFunction",
         "operation":"file://myapi.json#helloWorld"
      }
   ]
}

My interpretation about the specification, the sdk-net function definitions resource also use that

[
    {
       "name":"HelloWorldFunction",
       "operation":"file://myapi.json#helloWorld"
    }
 ]

My question which definition is correct? Should we define one of them or use both?

@spolti
Copy link
Member

spolti commented Mar 31, 2023

IMHO the second option is a JSON anti-pattern, when unmarshaling we would need to guess which struct to use.
my 2 cents:

{
   "functions": [
      {
         "name":"HelloWorldFunction",
         "operation":"myapi.json#helloWorld"
      }
   ]
}

and

{
   "functions": "file:///functions.yaml"
}

this way we are compliant with the spec and it is clearer on which struct it is defining.

@ribeiromiranda
Copy link
Collaborator Author

Issue closed because there are other discussions on the topic:

serverlessworkflow/specification#691
serverlessworkflow/specification#676
serverlessworkflow/specification#701

Due to the discussions and for the purpose of PR: #159 I agree with:

{
    "functions": [
       {
          "name":"HelloWorldFunction",
          "operation":"myapi.json#helloWorld"
       }
    ]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question ❓ Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants