Custom type serialization fixes
This commit is contained in:
parent
471f12b8ba
commit
6c81069b27
2 changed files with 3 additions and 8 deletions
|
@ -16,7 +16,7 @@ class InputFile extends ScalarType
|
|||
|
||||
public function serialize($value)
|
||||
{
|
||||
throw new InvariantViolation('`InputFile` cannot be serialized');
|
||||
return '';
|
||||
}
|
||||
|
||||
public function parseValue($value)
|
||||
|
|
|
@ -21,12 +21,12 @@ class Json extends ScalarType
|
|||
|
||||
public function serialize($value)
|
||||
{
|
||||
return $this->identity($value);
|
||||
return \json_encode($value);
|
||||
}
|
||||
|
||||
public function parseValue($value)
|
||||
{
|
||||
return $this->identity($value);
|
||||
return \json_decode($value, associative: true);
|
||||
}
|
||||
|
||||
public function parseLiteral(Node $valueNode, ?array $variables = null)
|
||||
|
@ -51,9 +51,4 @@ class Json extends ScalarType
|
|||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private function identity($value)
|
||||
{
|
||||
return $value;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue