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

334 fix endpoint validation #335

Merged
merged 5 commits into from
Oct 30, 2020
Merged

334 fix endpoint validation #335

merged 5 commits into from
Oct 30, 2020

Conversation

mmacai
Copy link
Collaborator

@mmacai mmacai commented Oct 29, 2020

Description

Closes #334

  • fixed proxy endpoint validation to not require path when path_regex is set

What to look out for

Dear reviewer, I want you to

  • gain knowledge - I think it's important for you to know about the change.
  • check that the code works on your machine.
  • suggest implementation-code design/structure/readability improvements.
  • suggest test-code design/structure/readability improvements.
  • suggest documentation improvements.
  • suggest language/writing improvements.
  • help to find bugs (described below!).

You can try to run RIG with this (on this branch vs master branch):

PROXY_CONFIG_FILE='[{"id":"my-service","name":"my-service","version_data":{"default":{"endpoints":[{"id":"my-endpoint","method":"GET","path":"/","path_replacement":"/different-endpoint"},{"id":"my-transformed-endpoint","method":"GET","path_regex":"/foo/([^/]+)/bar/([^/]+)","path_replacement":"/bar/\\1/foo/\\2"}]}},"proxy":{"use_env":true,"target_url":"API_HOST","port":7070}}]' \
mix phx.server

Process

The goal is to improve not only the code in this PR but also our skills! The "rules":

  • The review is considered "done" as soon as all reviewers have added their review, and all their comments have been addressed.
  • For knowledge-sharing reviews, each reviewer should "approve" the PR after studying its content.
  • After the approval, the merge is concluded by the developer.

Have fun!

lib/rig_api/v3/apis_test.exs Outdated Show resolved Hide resolved
lib/rig_inbound_gateway/api_proxy/validations.ex Outdated Show resolved Hide resolved
@mmacai
Copy link
Collaborator Author

mmacai commented Oct 29, 2020

@kevinbader Updated it in a way that it should be more clear and also catch the use-case when multiple path types are set.

@mmacai mmacai merged commit d7c30ae into master Oct 30, 2020
@mmacai mmacai deleted the 334-fix-endpoint-validation branch October 30, 2020 20:50
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

Successfully merging this pull request may close these issues.

Leaving out path in endpoint declaration let RIG fail on startup
2 participants