in zetasql-toolkit-core/src/main/java/com/google/zetasql/toolkit/catalog/io/JsonCatalogDeserializer.java [338:366]
public FunctionArgumentType deserialize(
JsonElement jsonElement, java.lang.reflect.Type type, JsonDeserializationContext context)
throws JsonParseException {
JsonObject jsonObject =
getAsJsonObject(
jsonElement,
"Invalid JSON function argument: " + jsonElement + ". Should be object.");
String argumentName =
getFieldAsString(
jsonObject,
"name",
"Invalid JSON function argument: " + jsonElement + ". Field name should be string.");
String argumentType =
getFieldAsString(
jsonObject,
"type",
"Invalid JSON function argument: " + jsonElement + ". Field type should be string.");
Type parsedArgumentType = parseType(argumentType);
return new FunctionArgumentType(
parsedArgumentType,
FunctionArgumentTypeOptions.builder()
.setArgumentName(argumentName, NamedArgumentKind.POSITIONAL_OR_NAMED)
.build(),
1);
}