Validation of required fields inconsistent
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 25/100
- Tipo de issue
- Error
- Claridad
- Necesita aclaración
- Estado de actividad
- Estancado
- Stack tecnológico
- python
- Área
- api, testing-qa
Línea de trabajo
The issue names no files or tests. First read the linked discussions and referenced issues #154, #312, #97, and #266 to determine the intended required-field validation policy, then locate the corresponding validator and tests. Done means the project has a decided, consistent behavior for standard, allOf, and referenced schemas, with coverage for that behavior.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
The validation of the required keyword does not make sense as it is implemented right now, IMHO.
- It really does not make any sense to list properties in
requiredthat do not exist. - If you want to use it with
allOfand therefore have properties inrequiredthat do not exist, there are already precautions (#154). - Currently, there is no validation error in the standard case but as soon as I have
allOfin my schema, there is a validation error. That is inconsistent. The PR that breaks it: #312 - In
$referenced schemas, the validation does not take effect either.
One of the main reasons why this should urgently be validated (as was in version 0.7.0) is that validators (that use the specification to validate requests/responses) will fail if there is e.g. a typo in one of the entries in required. And now there is no way to detect that.
In general, the OpenAPI/JsonSchema specification is quite relaxed. If only the bare minimum should be validated, this is probably not the only validation that can basically be removed completely.
My take on this:
- Best case: Throw validation errors for things that are obvious errors (like specifying a field as required that does not even exist).
- Second best option: make it configurable ("strict mode") or filterable (error IDs to exclude, filter levels, ...).
- Absolutely necessary minium: make it consistent.
I'd be willing to provide a PR. But since this has been going back and forth I'd like a decision first, where this is going.
- Lenguaje dominante
- Python
- Estrellas
- 409
- Forks
- 73
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de python-openapi/openapi-spec-validator
-
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 30/100
-
Dificultad 4/5 3-5 días Aptitud para principiantes 42/100
python-openapi/openapi-spec-validator#400 · 1 comentario ·
-
Dificultad 3/5 1-2 días Aptitud para principiantes 45/100
Todos los issues de python-openapi/openapi-spec-validator
Issues similares
-
documentation help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 90/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 90/100
simonw/sqlite-utils#872 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100