-
Notifications
You must be signed in to change notification settings - Fork 76
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
Fix nullable decoding #1637
Fix nullable decoding #1637
Changes from all commits
e65f39c
e5ece71
e7cd523
d53e5de
081bb3e
a8a6bcd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -354,8 +354,9 @@ object Schema { | |
private object OptionDefaultVisitor extends SchemaVisitor.Default[Option] { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note that I was not able to create any test cases that indicated an implementation for refinements would do anything here. Every case I could think of would still bypass calling the refinement case. The |
||
def default[A] : Option[A] = None | ||
override def option[A](schema: Schema[A]) : Option[Option[A]] = Some(None) | ||
override def biject[A, B](schema: Schema[A], bijection: Bijection[A, B]): Option[B] = | ||
this.apply(schema).map(bijection.to) | ||
override def biject[A, B](schema: Schema[A], bijection: Bijection[A, B]): Option[B] = { | ||
if (schema.hints.has[alloy.Nullable]) None else this.apply(schema).map(bijection.to) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} | ||
} | ||
|
||
def operation(id: ShapeId): OperationSchema[Unit, Nothing, Unit, Nothing, Nothing] = | ||
|
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.
Looks like this test case was actually asserting the wrong thing. In this case, a null default on a non-nullable field means that the default value is assumed to be
0