e2core icon indicating copy to clipboard operation
e2core copied to clipboard

No response returned when last step is aliased

Open calebschoepp opened this issue 4 years ago • 2 comments

When as is used to alias the output of the last step for a resource, Atmo returns nothing. For example the following returns nothing:

handlers:
  - type: request
    resource: /hello
    method: POST
    steps:
      - fn: helloworld
        as: something

Without looking at the codebase yet I'm assuming this is because Atmo implicitly assumes the final output matches the name of the last step. I think this should either be explicitly documented, or it should be surfaced as something you can modify. For example an output field that would allow you to declare where to look for the final output. Hopefully I'm not misunderstanding how data is passed between runnables :crossed_fingers:

calebschoepp avatar May 06 '21 06:05 calebschoepp

@calebschoepp this is a good point, and you're exactly right about the reasoning. There is already in fact that option, if you were to do the following:

handlers:
  - type: request
    resource: /hello
    method: POST
    steps:
      - fn: helloworld
        as: something
    response: something

That would work as you describe. I'm on the fence about whether something aliased should be returned automatically, as it's entirely possible that you explicitly DO NOT want to return something (I've done something like as: "--" in the past to return an empty response with 200 status)

Regardless, your point about documenting it explicitly stands. Let me think a bit about the behaviour, and we'll leave this open for sure.

cohix avatar May 06 '21 12:05 cohix

@cohix I was not aware of the response field. I think that the use case you bring up of not wanting to return something is completely valid. Documenting this behaviour or even just mentioning the response field in the docs (probably this page) would probably be enough.

calebschoepp avatar May 06 '21 16:05 calebschoepp