public ProcedureInfo deserialize()

in zetasql-toolkit-core/src/main/java/com/google/zetasql/toolkit/catalog/io/JsonCatalogDeserializer.java [432:462]


    public ProcedureInfo deserialize(
        JsonElement jsonElement, java.lang.reflect.Type type, JsonDeserializationContext context)
        throws JsonParseException {
      JsonObject jsonObject =
          getAsJsonObject(
              jsonElement,
              "Invalid JSON procedure: " + jsonElement + ". Preceduress should be objects.");

      String procedureName =
          getFieldAsString(
              jsonObject,
              "name",
              "Invalid JSON procedure: " + jsonElement + ". Field name should be string.");

      FunctionArgumentType[] arguments =
          Optional.ofNullable(jsonObject.get("arguments"))
              .map(
                  jsonArguments -> context.deserialize(jsonArguments, FunctionArgumentType[].class))
              .map(FunctionArgumentType[].class::cast)
              .orElseThrow(
                  () ->
                      new JsonParseException(
                          "Invalid JSON procedure: " + jsonElement + ". Arguments missing."));

      FunctionArgumentType returnType =
          new FunctionArgumentType(TypeFactory.createSimpleType(TypeKind.TYPE_STRING));

      FunctionSignature signature = new FunctionSignature(returnType, Arrays.asList(arguments), -1);

      return new ProcedureInfo(ImmutableList.of(procedureName), signature);
    }