Error resolving sub-schema property with type object or array
Ninguém assumiu esta issue ainda.
- #116 de @Kaiserunix — fechado sem integrar
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 20/100
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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
- Linguagem predominante
- Python
- Estrelas
- 281
- Forks
- 35
- Métricas de merge de PRs
- Nenhum PR com merge em 30d
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Sem modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de python-jsonschema/hypothesis-jsonschema
-
Missing test files in Pypi releaseTalvez já em andamento @blouirts123 assumiu há 49 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 35/100
-
Shouldn't PKG-INFO Homepage point to https://github.com/python-jsonschema/hypothesis-jsonschema ?Aberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 58/100
python-jsonschema/hypothesis-jsonschema#114 · 1 comentário ·
-
Push release tags to github?Aberta
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 55/100
python-jsonschema/hypothesis-jsonschema#113 · 1 reação ·
-
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 30/100
-
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 15/100
python-jsonschema/hypothesis-jsonschema#104 · 3 reações ·
Todas as issues de python-jsonschema/hypothesis-jsonschema
Issues semelhantes
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 92/100
Techiebutler/freeframe#687 ·
Mantenedores costumam responder em até 1 dia
-
bug verbose GC
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
IBM/javacore-analyser#677 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 79/100
Mantenedores costumam responder em até 2 dias
-
area/config comp/plugins P1 platform/qqbot tool/file type/bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
NousResearch/hermes-agent#163932 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
plugins/dsh: todayStr() computes UTC but is documented as local — journal entries written 00:00–08:00 local land in the previous day's fileTalvez já em andamento @Beehtrix assumiu hoje. Abertabug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
zilliztech/memsearch#907 · 1 comentário ·
Mantenedores costumam responder em até 1 dia