Skip to content
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

Error on GrpahQL mutation. #2114

Open
chonymony opened this issue Mar 19, 2024 · 0 comments
Open

Error on GrpahQL mutation. #2114

chonymony opened this issue Mar 19, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@chonymony
Copy link

Hello, I want to check if there-s any known error or maybe i'm doing something wrong with my GraphQL mutation. What I want is a simple update of a document as follows:

mutation updateProducto($producto: JSON!) {
        _replaceDocuments(json: $producto)
      }

And the variable:

{"producto":
  {
    "@id": "Producto/Producto%208",
    "@type": "Producto",
    "nombre": "Producto 8",
    "cantidad": "420",
    "disponible": true,
    "incorporacion": "2024-03-13T03:25:46.551Z",
    "precio": "69",
    "unidad": "unidad"
  }
}

After stringyfing the variable i keep getting the following error:

graphQLErrors: [
    {
      message: "prolog had the following exception: error(type_error(list,['terminusdb:///data/Producto/Producto%208']),_34290)",
      locations: [Array],
      path: [Array]
    }
  ],

Should i create a ticket or there's maybe something i'm not considering. Thanks in advance!
I haven't used prolog but apparently seems that is expecting a list with the IDs of the docs to replace (?). The funny part is that appears to be getting a list with one string with the URI of the document i want to replace 😮

The schema for reference:


{
  "@documentation": {
    "@comment": "Productos disponibles",
    "@properties": {
      "cantidad": "Cantidad del producto en números decimales.",
      "disponible": "Bandera para disponibilizar el producto",
      "incorporacion": "Fecha y hora en la que el producto se incorporó a la base de datos, este sirve para control de caducidades y de calidad.",
      "nombre": "Nombre del producto, este puede ser un nombre lexico, un id, un identificador interno según especificaciones.",
      "precio": "Precio del producto, es un número decimal positivo",
      "propiedades": "Objeto que extiende multidimensionalmente las propiedades del producto.",
      "unidad": "Este campo indica la unidad física en la que se expresa la cantidad del producto en el inventario, así como el precio del producto refiere a uno de esta unidad. como por ejemplo \"unidad\", \"litro\", \"kilogramo\", etc."
    }
  },
  "@id": "Producto",
  "@key": {
    "@fields": [
      "nombre"
    ],
    "@type": "Lexical"
  },
  "@metadata": {
    "embedding": {
      "query": "query($id: ID) {\n\tProducto(id: $id) {\n\t\tcantidad \n\t\tdisponible \n\t\tincorporacion \n\t\tnombre \n\t\tprecio \n\t\tpropiedades \n\t\tunidad\n\t}\n}",
      "template": "Nuestro inventario {{disponible \"sí\" true}} {{disponible \"no\" false}} tiene {{cantidad}} {{unidad}} de {{nombre}} disponible a la venta con un precio de {{precio}} pesos. Este producto fue incorporado en {{incorporacion}} con las siguientes características: {{propiedades}}"
    }
  },
  "@type": "Class",
  "cantidad": "xsd:decimal",
  "disponible": "xsd:boolean",
  "incorporacion": "xsd:dateTime",
  "nombre": "xsd:string",
  "precio": "xsd:decimal",
  "propiedades": {
    "@class": "sys:JSON",
    "@type": "Optional"
  },
  "unidad": "xsd:string"
}
@chonymony chonymony added the bug Something isn't working label Mar 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant