Skip to content

Make all API models convert to camelCase#132

Merged
DiamondJoseph merged 4 commits intomainfrom
camel-case
Apr 21, 2023
Merged

Make all API models convert to camelCase#132
DiamondJoseph merged 4 commits intomainfrom
camel-case

Conversation

@callumforrester
Copy link
Copy Markdown
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
Copy Markdown

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

Comment thread src/blueapi/utils/base_model.py
@DiamondJoseph DiamondJoseph merged commit 90b4710 into main Apr 21, 2023
@callumforrester callumforrester mentioned this pull request Apr 27, 2023
@DiamondJoseph DiamondJoseph deleted the camel-case branch May 27, 2025 09:31
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