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

How to do API versioning for APIs having the Cloud Function backends. #735

Open
AbhishekgowdaSC opened this issue Sep 29, 2022 · 3 comments

Comments

@AbhishekgowdaSC
Copy link

We need to do API versioning for the API having the multiple Cloud Function backends. Since we are using multiple cloud functions we can not specify the version in base path in open api config . Need something like we need to send the api version number from the headers and validate, but not sure how exactly we can do it can some one help on this?

@qiwzhang
Copy link
Contributor

You may need to use version prefix in your path. e.g. "/v1/path", "/v2/path". In your OpenAPI spec, you can specify the x-google-backend at operation level. Similar to this example.

Something like:

paths:
   /v1/path:
      get:
          x-google-backend:
              address: v1_backend_cloud_function

You may have to use path_translation to translate the path

@AbhishekgowdaSC
Copy link
Author

The above solution will not work in our case. Can we send some default header values via this and validate the version?

@qiwzhang
Copy link
Contributor

Are you suggesting using header to route to different version of your backend? Unfortunately, ESPv2 doesn't support routing to different backends based on HTTP header.

My impression is: GCLB supports routing based on HTTP headers. You can check it out.

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