-
Notifications
You must be signed in to change notification settings - Fork 14
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
Nested routes in sysl file and code gen #75
Comments
What's the actual problem? |
we basically need to repeat "Logic A" in Endpoint_A, Endpoint_B, Endpoint_C. They are the same code repeating for each of the above endpoints. |
Sysl describes relationships between applications (or systems). If your shared logic is internal to the application then it doesn't need to be defined in the specification, just write a method and call it in the required endpoints. If your shared logic is on a separate application then model it as a separate application. |
Just to be clear the issue here is around reusing code, and not the calls. The business flow will still make the same no of calls. Any custom code written to aggregate calls would make it convoluted in sysl file and would make diagramming impossible. I am not sure if there is a solution in Sysl and codegen at this moment. |
Have a discussion with @springwiz just now, i walked him through what we are facing for the moment while consuming the downstream. He is fully understand what we are facing in a code and business logic level. @andrewemeryanz, yes, i can see your points here. We can write our http call code which will do that logic, but moving that out ends up removing the related sysl file from:
to
which mean when we generate the diagram and swagger file will not be accurate. As @springwiz requests, this is not a simple decision that we could make to bring forward, thus looping @anzdaddy in as well. Cheers, |
@suipinglu Sindhu asked me to comment on this issue, I completely mis-understood the initial issue at first, I didn't realise the Anyway, as it turns out I think my answer I was going to give would be pretty close to the solution you want. I think you want the sysl to basically look like this:
where |
If i have made any confusion to you guys, sorry for that. :) |
I think I have a resolution.
Now, what you are going to do next is: call the handler b from the handler a. Assuming the BFF handler struct for Once you have the HandlerB struct in handler A, then you can call handler b freely from handler a. |
Hi everyone,
come across to a problem. we want to avoid repeating our code while implementing business logic.
what we want to describe as a sysl file:
The reason we want to reuse that "GET /v1/customer/{custId}/abc" is due to a large number of calls will repeat the code inside and it is not quite follow the "DRY" concept.
Cheers,
Ping
The text was updated successfully, but these errors were encountered: