Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix one/anyOf for objects without properties #42

Merged
merged 2 commits into from
Nov 3, 2022

Conversation

fliem
Copy link

@fliem fliem commented Nov 3, 2022

entity of type "object" that includes "oneOf" " or "anyOf" but no "properties" falls through the cracks (see below).

This PR fixes this.

Traceback (most recent call last):
  File "jsf/src/jsf/schema_types/object.py", line 40, in generate
    return super().generate(context)
  File "jsf/src/jsf/schema_types/base.py", line 49, in generate
    raise ProviderNotSetException()
jsf.schema_types.base.ProviderNotSetException

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "jsf/src/jsf/schema_types/object.py", line 40, in generate
    return super().generate(context)
  File "jsf/src/jsf/schema_types/base.py", line 49, in generate
    raise ProviderNotSetException()
jsf.schema_types.base.ProviderNotSetException

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "jsf/src/jsf/schema_types/object.py", line 40, in generate
    return super().generate(context)
  File "jsf/src/jsf/schema_types/base.py", line 49, in generate
    raise ProviderNotSetException()
jsf.schema_types.base.ProviderNotSetException

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "mockdatageneration/prototype/test.py", line 19, in <module>
    data = faker.generate()
  File "jsf/src/jsf/parser.py", line 143, in generate
    return self.root.generate(context=self.context)
  File "jsf/src/jsf/schema_types/object.py", line 42, in generate
    return {o.name: o.generate(context) for o in self.properties if self.should_keep(o.name)}
  File "jsf/src/jsf/schema_types/object.py", line 42, in <dictcomp>
    return {o.name: o.generate(context) for o in self.properties if self.should_keep(o.name)}
  File "jsf/src/jsf/schema_types/object.py", line 42, in generate
    return {o.name: o.generate(context) for o in self.properties if self.should_keep(o.name)}
  File "jsf/src/jsf/schema_types/object.py", line 42, in <dictcomp>
    return {o.name: o.generate(context) for o in self.properties if self.should_keep(o.name)}
  File "jsf/src/jsf/schema_types/object.py", line 42, in generate
    return {o.name: o.generate(context) for o in self.properties if self.should_keep(o.name)}
TypeError: 'NoneType' object is not iterable

@ghandic ghandic merged commit e0a38bc into ghandic:main Nov 3, 2022
@ghandic
Copy link
Owner

ghandic commented Nov 3, 2022

Thanks for the PR! Great catch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants