Error resolving sub-schema property with type object or array
Nadie ha tomado este issue todavía.
- #116 de @Kaiserunix — cerrado sin fusionar
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 20/100
Línea de trabajo
Start by reproducing the supplied schema with hypothesis==6.47.0, hypothesis-jsonschema==0.22.0, and jsonschema==4.6.0, then trace how $defs/def_foo is resolved. Compare the resolver behavior for the object and array cases in the example. Done means the example no longer raises RefResolutionError; an open pull request is already linked.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
The following jsonschema provokes hypothesis-jsonschema to fail:
from hypothesis import given
from hypothesis_jsonschema import from_schema
schema = {
"$schema": "http://json-schema.org/draft-04/schema#",
"$defs": {
"def_foo": {
"properties": {
"foo": {"type": "string"}
},
"additionalProperties": False,
},
"def_bar": {
"type": "object",
"properties": {
"bar": {
"type": ["object", "array"],
"$ref": "#/$defs/def_foo",
"items": {
"type": "object",
"$ref": "#/$defs/def_foo",
},
},
},
},
},
"allOf": [
{"$ref": "#/$defs/def_bar"},
],
}
@given(from_schema(schema))
def test_dummy(instance):
assert True
Exception:
self = <hypothesis_jsonschema._resolve.LocalResolver object at 0x7f2a1058ce10>
document = {'additionalProperties': {'not': {}}, 'items': {'$ref': '#/$defs/def_foo', 'type': 'object'}, 'maxProperties': 1, 'properties': {'foo': {'type': 'string'}}, ...}
fragment = '$defs/def_foo'
def resolve_fragment(self, document, fragment):
"""
Resolve a ``fragment`` within the referenced ``document``.
Arguments:
document:
The referent document
fragment (str):
a URI fragment to resolve within it
"""
fragment = fragment.lstrip(u"/")
parts = unquote(fragment).split(u"/") if fragment else []
for part in parts:
part = part.replace(u"~1", u"/").replace(u"~0", u"~")
if isinstance(document, Sequence):
# Array indexes should be turned into integers
try:
part = int(part)
except ValueError:
pass
try:
document = document[part]
except (TypeError, LookupError):
raise exceptions.RefResolutionError(
> "Unresolvable JSON pointer: %r" % fragment
)
E jsonschema.exceptions.RefResolutionError: Unresolvable JSON pointer: '$defs/def_foo'
./venv/bin/python3.6/site-packages/jsonschema/validators.py:814: RefResolutionError
Environment:
Python version: 3.10.4hypothesis==6.47.0hypothesis-jsonschema==0.22.0jsonschema==4.6.0
- Lenguaje dominante
- Python
- Estrellas
- 281
- Forks
- 35
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la 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-jsonschema/hypothesis-jsonschema
-
Missing test files in Pypi releasePosiblemente ocupada @blouirts123 la tomó hace 49 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 35/100
-
Shouldn't PKG-INFO Homepage point to https://github.com/python-jsonschema/hypothesis-jsonschema ?Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 58/100
python-jsonschema/hypothesis-jsonschema#114 · 1 comentario ·
-
Push release tags to github?Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 55/100
python-jsonschema/hypothesis-jsonschema#113 · 1 reacción ·
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 30/100
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 15/100
python-jsonschema/hypothesis-jsonschema#104 · 3 reacciones ·
Todos los issues de python-jsonschema/hypothesis-jsonschema
Issues similares
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 78/100
web-push-libs/pywebpush#216 · 1 comentario ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
AgriciDaniel/claude-seo#572 ·
Los mantenedores suelen responder en 5 días
-
area:print-dispatch
Dificultad 2/5 1-3 horas Aptitud para principiantes 92/100
Los mantenedores suelen responder en 1 día
-
area: docs domain: technical-writing good first issue type: documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 80/100
Deepak3699/Ai_Mentor#919 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día