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

Make all API models convert to camelCase #132

Merged
merged 4 commits into from
Apr 21, 2023
Merged

Make all API models convert to camelCase #132

merged 4 commits into from
Apr 21, 2023

Conversation

callumforrester
Copy link
Contributor

@callumforrester callumforrester commented Apr 20, 2023

Previously, with apischema, the API models were serialized with camel case aliasing. For example, converting a Python field called foo_bar to a JSON field called fooBar and vice versa. This is to comply with the Google JSON style guide.

https://google.github.io/styleguide/jsoncstyleguide.xml?showone=Property_Name_Format#Property_Name_Format

This PR adds a custom base model with custom config primarily to preserve this change and also to prevent the ingestion of arbitrary JSON alongside a model's known fields, which apischema also did not allow.

@codecov
Copy link

codecov bot commented Apr 20, 2023

Codecov Report

Merging #132 (4c35abb) into main (a7c897f) will increase coverage by 0.34%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #132      +/-   ##
==========================================
+ Coverage   74.17%   74.52%   +0.34%     
==========================================
  Files          36       37       +1     
  Lines        1034     1048      +14     
==========================================
+ Hits          767      781      +14     
  Misses        267      267              
Impacted Files Coverage Δ
src/blueapi/core/context.py 77.04% <ø> (-1.08%) ⬇️
src/blueapi/config.py 100.00% <100.00%> (ø)
src/blueapi/core/bluesky_types.py 87.87% <100.00%> (+0.37%) ⬆️
src/blueapi/service/model.py 81.25% <100.00%> (+0.60%) ⬆️
src/blueapi/utils/__init__.py 100.00% <100.00%> (ø)
src/blueapi/utils/base_model.py 100.00% <100.00%> (ø)
src/blueapi/worker/event.py 90.00% <100.00%> (+0.20%) ⬆️
src/blueapi/worker/task.py 73.33% <100.00%> (+0.91%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

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