-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
add ability to patch botocore specs #6812
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a perfect compromise:
- Since we still use the original spec files coming with botocore (and don't maintain our own fork), we can still rely on the automatic spec updates w/ botocore and our ASF update action.
- The
spec-patches.json
is a perfect log-book for our changes where we can easily add new patches.
I was a bit worried if the patched service specs are used by all components in the loop (especially when using the fallback / forwarding mechanisms), therefore I wrote a small test to verify that. In addition, I activated the s3
test as suggested by @thrau.
@steffyP From my side this would be good to go. Let me know if it's fine for you as well, if you would do things differently, or if you are missing any features concerning the spec patching. 🚀
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM :) thanks for adding this feature
This PR adds a
PatchingLoader
to ASF, which allows dynamic patching of botocore specs using jsonpatch.This is mainly needed for s3 exception and response types, where the status codes defined in the spec are often missing or differ from what AWS actually returns. Some exception types are also missing custom attributes.
Patches are collected into
spec-patches.json
which is just a dictionary of botocore spec path -> jsonpatch document for that spec.I also added an example patch to demonstrate how to use it.
@alexrashed i hope you find this to be an acceptable compromise between the two extremes of patching botocore objects vs providing our own spec files. 🙂 by adding patched services to
test_generated_code_compiles
, we make sure that the patches are actually compatible with the spec, so that, should the spec diverge, we immediately get notified. (Jsonpatch is pretty picky on JSON shapes being compatible with patches)if you want changes, please feel free to edit and merge the PR