opendiffy / diffy

Other
1.25k stars 142 forks source link

Allows specifying resource names in the start up configuration #29

Closed pedromss closed 4 years ago

pedromss commented 4 years ago

This PR aims to allow diffy deployments to specify resource names in the startup options instead of the Canonical-Resource header. The new parameter is optional and the header still takes precedence over the startup configuration.

This allows for resource naming in the UI to be set during deployment and not changed, also not forcing clients to make requests with an additional header.

Could use guidance with:

codecov-io commented 4 years ago

Codecov Report

Merging #29 into master will increase coverage by 0.29%. The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #29      +/-   ##
=======================================
+ Coverage    66.7%   67%   +0.29%     
=======================================
  Files          32    32              
  Lines         889   897       +8     
  Branches       28    20       -8     
=======================================
+ Hits          593   601       +8     
  Misses        296   296
Impacted Files Coverage Δ
src/main/scala/ai/diffy/lifter/HttpLifter.scala 91.66% <100%> (ø) :arrow_up:
...ain/scala/ai/diffy/proxy/HttpDifferenceProxy.scala 66.66% <100%> (ø) :arrow_up:
src/main/scala/ai/diffy/DiffyServiceModule.scala 100% <100%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update b1864a7...0b81b7d. Read the comment docs.

puneetkhanduri commented 4 years ago

Thanks for the pull request. I like the idea and want to make this slightly more ambitious proposal.

Your current implementation is limited to static path structures while most applications use path parameters like /users/:userid/transactions/:trasactionid/amount.

Please take a look at this implementation of PathPattern.

You can use a similar implementation to find matching path names for each request. This would make the solution useful for all Diffy http users.

pedromss commented 4 years ago

@puneetkhanduri can you recomend one implementation that I can use (i.e. not private in another artifact) as to avoid copy pasting the one you linked?

puneetkhanduri commented 4 years ago

Unfortunately, no. I think writing something similar to this might be the fastest way forward.

pedromss commented 4 years ago

@puneetkhanduri I finally had time to complete this. I believe it now does what you suggested. Please take a look when you can

pedromss commented 4 years ago

@puneetkhanduri please take another look :)