-
Notifications
You must be signed in to change notification settings - Fork 96
Pre-Processor Function #254
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
|
Do you want to review this pr @Slluxx? since you were the one who asked for this functionality, you should say if it does what you need it to do |
|
Yeah, this is exactly what i wished for! Im sure this will help a lot of people. I wonder if a |
|
@LucasQR quick reminder |
|
I just need you to tell me how it would work so i can tell you if it makes sense and add it to the code if it does |
|
Well, lets assume a user has a list of items, linked via userid. A user is able to create, modify and delete items. Then i need to get the user token via http cookie, use the pre-processor to get the user-id and then delete the entries. Same as with create and update, just for deleting - making sure a user valid and not injecting some id to delete other users entries. |
|
Just to avoid any confusion, we should make clear what needs to be done and who is working on it. I am not quite sure what @igorbenav last message means. |
|
@LucasQR is the one working on it, I review his work (and you review it as well). Conversation related to the PR should happen here |
|
@Slluxx i made the delete, do you want to take a look? |
|
Looks good to me! |
|
Is It planning to merge? Cuz i so waiting this!🙏 looks so great for my locals projects! It'll so helps me! |
|
I'll check with @igorbenav about it and get back to you |
|
Hey guys, merging it (and some other stuff) and creating a new release tomorrow |
|
Didn't have the time, sorry. I'll try to do it tomorrow (Monday) |
|
@LucasQR it's just missing the docs update so I can merge it |
|
I didn't find any commits or text in release's doc that it's already released... I will be in next release version or i missed something? Am i right? |
|
@AlphaO612 you'll see here as server-side field injection. It's also in the docs. |
Solves:
This pr solves #242
Description
This PR introduces CreateConfig and UpdateConfig classes that enable automatic server-side field injection during create
and update operations. This feature allows developers to automatically inject fields (like user_id from authentication
context, timestamps, audit fields) before writing to the database, while optionally hiding these fields from the API
request schema.
Changes
New Classes and Functions
exclude_from_schema attributes
FilterConfig pattern, using inspect.Signature for proper FastAPI dependency injection
fields excluded using pydantic.create_model()
Modified Files
API Usage Example
Tests
Added comprehensive test coverage in tests/sqlalchemy/endpoint/test_create_update_config.py:
All tests pass successfully. The implementation also passes:
Additional Notes
Key Features
Checklist