-
Notifications
You must be signed in to change notification settings - Fork 6
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
Correct generated schema for Reference types #522
Conversation
1a3563c
to
0777265
Compare
6fbd473
to
c90b691
Compare
When bluesky protocol types are translated into references to allow them to be passed by name from external processes, the generated schema needs to specify the type that the reference should refer to rather than the type of the value itself (str). The previous version used the field name as the key for this entry in the schema instead of the constant 'type' used and expected elsewhere.
c90b691
to
2f08d79
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #522 +/- ##
=======================================
Coverage 91.06% 91.06%
=======================================
Files 40 40
Lines 1779 1779
=======================================
Hits 1620 1620
Misses 159 159 ☔ View full report in Codecov by Sentry. |
Should the type value change as well? The |
Instead of using the repr(cls) output. Gives bluesky.protocols.Readable instead of <class 'bluesky.protocols.Readable'>
0a1036c
to
46598b0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Do we
want to include some field in the schema to mark that the field should be a
reference rather than the value itself?
Possibly, but let's do that in another PR, could also be done as part of #518
We can infer it from whether the type is a known type or otherwise referenced in the schema. Any time we have as a plan parameter a BaseModel/Dataclass/TypedDict, I think the generated schema will include |
I think this resolves the plan schemas returned from the plans endpoint. Do we
want to include some field in the schema to mark that the field should be a
reference rather than the value itself?