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

Multiple fittings with parameters in a pipe #28

Open
enorm opened this issue Jun 26, 2017 · 1 comment
Open

Multiple fittings with parameters in a pipe #28

enorm opened this issue Jun 26, 2017 · 1 comment

Comments

@enorm
Copy link

enorm commented Jun 26, 2017

Hi,

I want to define multiple fittings with parameters in a single pipe.

This works (multiple fittings without parameters):

    # pipe to serve swagger (endpoint is in swagger.yaml)
    swagger_raw:
      - swagger_raw
      - another_fitting

This also works (one fitting with parameters):

    # pipe to serve swagger (endpoint is in swagger.yaml)
    swagger_raw:
      name: swagger_raw
      filter: "^(?!x--.*)"
      privateTags:
        - x-swagger-router-controller
        - x-swagger-pipe

This does not work (array syntax):

    # pipe to serve swagger (endpoint is in swagger.yaml)
    swagger_raw:
      - name: swagger_raw
        filter: "^(?!x--.*)"
        privateTags:
          - x-swagger-router-controller
          - x-swagger-pipe

Error message:

Error: Pipe not found: ^(?!x--.*)
    at Bagpipes.getPipe (/.../node_modules/bagpipes/lib/bagpipes.js:46:11)
    at /.../node_modules/bagpipes/lib/fittings/parallel.js:20:30
    at /.../node_modules/lodash/index.js:3073:15
    at baseForOwn (/.../node_modules/lodash/index.js:2046:14)
    at /.../node_modules/lodash/index.js:3043:18
    at Function.<anonymous> (/.../node_modules/lodash/index.js:3346:13)
    at parallel (/.../node_modules/bagpipes/lib/fittings/parallel.js:18:7)
    at Runner.<anonymous> (/.../node_modules/bagpipes/lib/bagpipes.js:171:7)
    at bound (domain.js:280:14)
    at Runner.runBound (domain.js:293:12)

What I want to do actually:

    # pipe to serve swagger (endpoint is in swagger.yaml)
    swagger_raw:
      - name: swagger_raw
        filter: "^(?!x--.*)"
        privateTags:
          - x-swagger-router-controller
          - x-swagger-pipe
      - name: another_fitting

So, what is the correct syntax to add multiple fittings with parameters to a single pipe?

Best regards,
Norman

@theganyo
Copy link
Contributor

You'd need to break out parameterized definition. Something like:

my_fitting:
    name: swagger_raw
    filter: "^(?!x--.*)"
    privateTags:
      - x-swagger-router-controller
      - x-swagger-pipe

swagger_raw:
  - my_fitting
  - another_fitting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants