-
Notifications
You must be signed in to change notification settings - Fork 149
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
Function definition namespaces (Importing several function definition files) #676
Comments
@fjtirado Funny, I had the exact same proposal, as I started coding Synapse's resource server at the end of last week. Wanted to bring it up in today's meeting, but there you go! +1000 For namespaces, however, I'd try to find, if possible, something more elegant than file-based. And IMO the term is not ubiquitous enough, as the same concept could very well be applied to at least events and auth too. I have nothing in mind right now, but even something as |
I liked the idea as well, and I agree that I'd rather use Maybe |
yes, I think functionImports is fine, I just mention namespace becuase of my c++ heritage ;) |
Then: {
"functions": [{
"operation": "myfile.yaml#myoperation"
"name": "privateFunction1"
}],
"functionImports": {
"sharedApi": "sharedFunctionDefinitions.json",
"sharedApi2": "sharedFunctionDefinitions2.json"
}
} The format is Then in the states we refer by |
@ricardozanini functionImports should be an object (it is a dictionary) not an array. |
imo the aggregation should happen on runtime side. having an uri is enough for me. i rather not add this is possible, so sorry |
@tsurdilo how do we agregate on runtime? can you give an example? |
this uri endpoint can aggregate all your function defs and stick in the functions array which then is also validatable against our single functions schema |
@tsurdilo IMHO, your suggestion is impossible to define and/or implement. How can you, as a runtime, determine the format of the data returned by a random url? Sometimes it might just be a JSON of a functionDef collection, sometimes a collection of collections, etc. |
this is a compile time resolve so yes you can validate its response json, otherwise implement the validation on service side that returns the resolved json, thats fine too since in most cases you control it |
how does that URI endpoint knows what needs to be aggregated? |
what we did this for (ability to use uri) is for runtimes to be able to provide function definitions out of the box to users. |
these types of requests where its more about runtime user support and not the spec itself are things that all i can say is "deal with it", again sry. |
No, you can't. First of all, there is no such thing as compile time. Second, you don't know what a endpoint you have no control on as implementer will return. As I said, it could be a single collection, a collection of collections, a file containing references to other files, etc. What you suggest will result in implementation mess and zero portability of SW between runtimes, even though that is the main focus of the spec. |
ok, scenario two, I have a external function defintion magic array provider (if I understood correctly) and now I want to define my own private array of function for that specific file (because my file use functions in that external URI and also expressions that are defined in that functions array) , how do I do that if functions property either points to the the URI or to the array of function definitions? |
put it inline in the definition then. i honestly dont see anything that we can do except add some "improvements" that again wont work for everyone. so uri is uri |
ok, so you are basically proposing to copy paste the content of the function definition array contained in the file and add the private function inline, do you? |
use expression if you want as the string and have runtime eval it if that makes it easier, idk. but we are starting to look like google cloud workflow here..and i dont like it |
@tsurdilo uri is uri, but it can be uris, I honestly do not see the rationale agains that, I think you need to elaborate a bit more. |
On that specific subject, that's not necessarily a bad thing! Even though I'm sure we can perfectly work without that "feature", I'm convinced it's a good, quality of life one. Like the bookmarking we spoke about. I believe the main problem here is: how to reference multiple (possibly namespaced) function (or event or auth, ...) definition collections in a PORTABLE way (meaning works the same accross implementations)? So far, we cant achieve that out of the box with what the spec proposes. |
ok well if you guys feel this is helpful then go for it 👍 |
ok, should we proceed to open a PR then? |
ok i think i understand this better now, imo this concept is great but would require some thinking how it would fit overall to the concept of all our dsl not just particular piece of function defs imo right now this is already possible via metadata so lets think about this some more please |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
@tsurdilo This cannot be achieved using metadata or extension without loss of intercompatibility , which is IMHO the main and most important aspect of a proper DSL. |
Related to #691 |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I think @cdavernas is covering this issue with #701, therefore closing |
Superseded by #691 |
As per spec "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."
This covers the following scenarios:
But it does not cover two different scenarios that might arise:
Therefore, I propose to update the Workflow specification to:
So, we will have something like in the header of the flow
and
The text was updated successfully, but these errors were encountered: