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

Convert Service to REST using FastAPI and Make ScanSpecs Pydantic Models #56

Merged
merged 41 commits into from
Jan 24, 2023

Conversation

callumforrester
Copy link
Contributor

@callumforrester callumforrester commented Oct 28, 2022

As discussed offline, merging #52 and #53 into one big PR.

  • Replace the GraphQL service with a FastAPI REST service and
  • Convert ScanSpecs to pydantic models.
  • Add a new decorator @discriminated_union_of_subclasses to enable similar tagged union behaviour to the GraphQL service
  • Write tests for REST service
  • Write API documentation
  • Remove all references to GraphQL

@codecov
Copy link

codecov bot commented Jan 4, 2023

Codecov Report

Merging #56 (d01dac8) into master (6d61d84) will increase coverage by 0.48%.
The diff coverage is 98.28%.

@@            Coverage Diff             @@
##           master      #56      +/-   ##
==========================================
+ Coverage   95.56%   96.04%   +0.48%     
==========================================
  Files           9        9              
  Lines         902      886      -16     
==========================================
- Hits          862      851      -11     
+ Misses         40       35       -5     
Impacted Files Coverage Δ
src/scanspec/cli.py 90.62% <ø> (ø)
src/scanspec/service.py 95.76% <96.00%> (+5.33%) ⬆️
src/scanspec/core.py 99.45% <100.00%> (+0.38%) ⬆️
src/scanspec/regions.py 100.00% <100.00%> (ø)
src/scanspec/specs.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@callumforrester callumforrester marked this pull request as ready for review January 4, 2023 12:09
@callumforrester callumforrester requested a review from coretl January 4, 2023 12:09
@callumforrester callumforrester changed the title WIP: Convert Service to REST using FastAPI and Make ScanSpecs Pydantic Models Convert Service to REST using FastAPI and Make ScanSpecs Pydantic Models Jan 4, 2023
src/scanspec/core.py Show resolved Hide resolved
src/scanspec/core.py Outdated Show resolved Hide resolved
src/scanspec/service.py Show resolved Hide resolved
src/scanspec/service.py Show resolved Hide resolved
src/scanspec/service.py Show resolved Hide resolved
src/scanspec/specs.py Show resolved Hide resolved
@callumforrester callumforrester merged commit 7461cef into master Jan 24, 2023
@callumforrester callumforrester deleted the fastapi-and-pydantic branch January 24, 2023 09:41
DiamondJoseph added a commit to DiamondLightSource/tickit that referenced this pull request Jul 10, 2023
- Replace as_tagged_union with equivalent discriminated_union_of_subclasses from bluesky/scanspec#56
- Replace dataclass usage with Pydantic dataclass
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