Repository navigation
fix: Better handling for optional arguments - #1124
Conversation
276c168 to
f2601b3
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1124 +/- ##
=======================================
Coverage 94.48% 94.48%
=======================================
Files 41 41
Lines 2555 2557 +2
=======================================
+ Hits 2414 2416 +2
Misses 141 141 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
f2601b3 to
9cc49b6
Compare
9cc49b6 to
5842edf
Compare
| "radius": { | ||
| "description": "Radius of the circle", | ||
| "exclusiveMinimum": 0, | ||
| "exclusiveMinimum": 0.0, |
There was a problem hiding this comment.
I do not know why these changes have appeared here just from adjusting handling of | None, as they do not allow None or defaults... I have always been confused why they got set to integer 0 instead of float 0.0, and I think this is more correct but why!?
StrictConfig: ConfigDict = {"extra": "forbid", "arbitrary_types_allowed": True}
@dataclass(config=StrictConfig)
class Circle(Region[Axis]):
[...]
radius: float = Field(description="Radius of the circle", gt=0.0)
tpoliaw
left a comment
There was a problem hiding this comment.
I'm not sure what I think of int | None being treated differently to int | None = None but I can't think of a better way and this does make the schema more useful in the majority of cases.
Can I think of any examples where they are using the 2nd and shouldn't actually be using the first? Not right now. Not giving None a privileged default? But if that is what your plan should have, cutting the possibility of passing None means you must pass an int. |
Create a dropdown menu for selecting a plan, populate using a mocked call to blueapi using mockserviceworker. Edit mocked output assuming that the following have been fixed: - DiamondLightSource/blueapi#1129 - DiamondLightSource/blueapi#1123 - DiamondLightSource/blueapi#1124 And reorder the scanspec schema so that its self-referential components can be detected in a single pass.
Create a dropdown menu for selecting a plan, populate using a mocked call to blueapi using mockserviceworker. Edit mocked output assuming that the following have been fixed: - DiamondLightSource/blueapi#1129 - DiamondLightSource/blueapi#1123 - DiamondLightSource/blueapi#1124 And reorder the scanspec schema so that its self-referential components can be detected in a single pass.
Create a dropdown menu for selecting a plan, populate using a mocked call to blueapi using mockserviceworker. Edit mocked output assuming that the following have been fixed: - DiamondLightSource/blueapi#1129 - DiamondLightSource/blueapi#1123 - DiamondLightSource/blueapi#1124 And reorder the scanspec schema so that its self-referential components can be detected in a single pass.
Create a dropdown menu for selecting a plan, populate using a mocked call to blueapi using mockserviceworker. Edit mocked output assuming that the following have been fixed: - DiamondLightSource/blueapi#1129 - DiamondLightSource/blueapi#1123 - DiamondLightSource/blueapi#1124 And reorder the scanspec schema so that its self-referential components can be detected in a single pass.
To be merged into main after #1122 rather than into #1122 just arranged for convenient review.
Adjusts handling of optional arguments in plan parameters to use the
requiredfield from the JsonSchema only instead of additionally explicitly allowingnullas an argument. This makes the schema easier to read and automated tools should work better with it.