Validation of required fields inconsistent
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 5/5
- Temps estimé
- Plus d'une semaine
- Accessibilité débutants
- 25/100
- Type d'issue
- Bug
- Clarté
- À clarifier
- Activité
- À l'abandon
- Stack technique
- python
- Domaine
- api, testing-qa
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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.
- Langage dominant
- Python
- Étoiles
- 409
- Forks
- 73
- Métriques de merge des PR
- Aucune PR mergée en 30 j
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de python-openapi/openapi-spec-validator
-
Difficulté 4/5 3-5 jours Accessibilité débutants 55/100
-
Difficulté 3/5 1-2 jours Accessibilité débutants 55/100
-
Difficulté 3/5 1-2 jours Accessibilité débutants 30/100
-
Difficulté 4/5 3-5 jours Accessibilité débutants 42/100
python-openapi/openapi-spec-validator#400 · 1 commentaire ·
-
Difficulté 3/5 1-2 jours Accessibilité débutants 45/100
Toutes les issues de python-openapi/openapi-spec-validator
Issues similaires
-
documentation help wanted
Difficulté 2/5 1-3 heures Accessibilité débutants 90/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 90/100
simonw/sqlite-utils#872 ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100