The `submit_permission` dependency causes duplicate validation errors

Abierto
#1,812 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
Medio día
Aptitud para principiantes
45/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
fastapi, python
Área
backend

Línea de trabajo

The duplicate errors come from the submit_permission dependency deserialising the request body separately from the main /api/v1/tasks endpoint. Start by finding that dependency and where it reads TaskRequest, then compare it with a test endpoint that has no dependency, which returns one error. Done means one validation error for an invalid TaskRequest on the tasks endpoint, with the existing tests still passing.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Found while looking into #1802, if an invalid TaskRequest is passed to the /api/v1/tasks endpoint, two validation errors are returned instead of the expected one.

$ curl -H "Authorization: Bearer ${TOKEN}" http://localhost:8000/api/v1/demo --json '{"name": "count", "params": [], "instrument_session": "cm12345-1"}' | jq
{
  "detail": [
    {
      "type": "dict_type",
      "loc": [
        "body",
        "params"
      ],
      "msg": "Input should be a valid dictionary",
      "input": []
    },
    {
      "type": "dict_type",
      "loc": [
        "body",
        "params"
      ],
      "msg": "Input should be a valid dictionary",
      "input": []
    }
  ]
}

This seems to be from deserialising the task for the main endpoint, as well as for the submit_permission. Passing the same JSON to a test endpoint without the dependency returns a single error.

Lenguaje dominante
Python
Estrellas
14
Forks
15
Merge medio
3 d 2 h
PR fusionados (30 d)
35

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de DiamondLightSource/blueapi

Todos los issues de DiamondLightSource/blueapi

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.