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

feat: Add flag to not use alias for Pydantic’s json schema generation #9

Merged

Conversation

fbrueck
Copy link
Contributor

@fbrueck fbrueck commented Jan 15, 2025

I am using aliases to parse input data from camelCase to snake_case. I want to keep the snake_case for the Glue schema.

To do so, I need to pass the by_alias=False flag to Pydantic’s model_json_schema function.

The default behaviour remains unchanged.

Thank you for this nice little library :)

Copy link
Owner

@svdimchenko svdimchenko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fbrueck thanks for your contribution! ❤️
Would you mind to add unit test for this feature ?
It would be nice to add this flag description to README.md

@fbrueck fbrueck force-pushed the feat/generate-json-schema-by-name branch 2 times, most recently from 6fc4211 to 551e2ed Compare January 15, 2025 16:55
@fbrueck
Copy link
Contributor Author

fbrueck commented Jan 15, 2025

Thanks! I did add a test for argument parsing.

@fbrueck fbrueck requested a review from svdimchenko January 15, 2025 16:58
@fbrueck fbrueck force-pushed the feat/generate-json-schema-by-name branch from 551e2ed to 7846210 Compare January 15, 2025 17:00
@svdimchenko
Copy link
Owner

svdimchenko commented Jan 15, 2025

Thanks! I did add a test for argument parsing.

Thanks for that, however I meant that it makes sense to add pydantic model example and expected results for case when by_alias flag is disabled.
Here are such tests examples: https://github.com/svdimchenko/pydantic-glue/blob/main/tests/unit/test_convert.py

@svdimchenko svdimchenko merged commit 73fa98e into svdimchenko:main Jan 31, 2025
7 checks passed
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.

2 participants