Generate integers for "number" schema?

Abierto
#80 1 comentario 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
25/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
json, python

Línea de trabajo

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.

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

Descripción

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.

Lenguaje dominante
Python
Estrellas
281
Forks
35
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

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 python-jsonschema/hypothesis-jsonschema

Todos los issues de python-jsonschema/hypothesis-jsonschema

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.