Ask a Question

swagger 2.0. parameters in path cannot be reuse in backend call

kaspanoombro
New Contributor

swagger 2.0. parameters in path cannot be reuse in backend call

 
 

I have this path in and endpoint definition in swagger 2.0:

paths:
      /custom_texts/{lang}:
        get:
          parameters:
            - in: path
              name: lang
              required: true
              type: string
          x-backend:
            address: https://another-server.com/translation{lang}

To call it: http://myserver/custom_texts/en but the the backend is called like this: http://myserver/custom_texts/?lang=en

I tried with $request.path.lang but does not worked either? How can i use the value of the lang parameter in the backend call? Thank you.

EDIT I tried with https://swagger.io/docs/specification/callbacks/ But this does not get interpreted:

address: https://another-server.com/translation{$request.query.lang}
2 REPLIES 2
chichepo
Frequent Contributor

Hi @kaspanoombro 
any chance to make it using OAS 3?

kaspanoombro
New Contributor

No i can't. I must use 2.0.

cancel
Showing results for 
Search instead for 
Did you mean: