Generate integers for "number" schema?

Ouverte
#80 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
25/100
Type d'issue
Fonctionnalité
Clarté
Plutôt claire
Activité
À l'abandon
Stack technique
json, python
Domaine
backend, testing-qa

Piste de recherche

Read the strategy that maps the JSON Schema "number" type to st.float, then trace how schema canonicalization handles not, minimum, and integer types. Consider whether integer generation should be included and how that affects output variation and negated schemas; done means the strategy and its tests cover the intended behavior. The issue has had no activity for years, so check whether the work is still relevant before starting.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

At the moment the "number" type corresponds to st.float strategy, but as integers are valid for the "number" type in JSON Schema, I am wondering whether it will make sense to generate integers there as well.

I believe it may increase the output variation. What do you think?

I was thinking about your comment in the context of negating schemas and tried to canonicalise {"not": {"minimum": 42}} which gives {'not': {'minimum': 42, 'type': 'number'}, 'type': 'number'}. Even though it is a valid transformation, it seems too restrictive. For example, the end-user might expect that negating {"minimum": 42} will give e.g. 41, or some other integers, but there will be always floats. Having type: integer in place will solve this ({"not": {"minimum": 42}, "type": "integer"} works), but still sometimes it happens that it is missing.

Langage dominant
Python
Étoiles
281
Forks
35
Métriques de merge des PR
Aucune PR mergée en 30 j

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de python-jsonschema/hypothesis-jsonschema

Toutes les issues de python-jsonschema/hypothesis-jsonschema

Issues similaires

Plus d'issues Python

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.