Skip to content

any_of='use-first' not working #297

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

Closed
kurtrwall opened this issue Oct 10, 2024 · 3 comments · Fixed by #301
Closed

any_of='use-first' not working #297

kurtrwall opened this issue Oct 10, 2024 · 3 comments · Fixed by #301
Labels
pinned Don't mark stale question

Comments

@kurtrwall
Copy link

Describe the bug
Btw, great library, thanks for making it!

I'm trying to use this with draft 6 jsonschema (Microsoft's AdaptiveCard schema, and I'm still getting:

NotImplementedError: anyOf is not supported as bare property (workarounds available by setting any_of flag)

Example Schema and code

import python_jsonschema_objects as pjs
import requests
schema = requests.get('https://adaptivecards.io/schemas/adaptive-card.json').json()
ns = builder.build_classes(any_of='use-first')
...snip
NotImplementedError: anyOf is not supported as bare property (workarounds available by setting any_of flag)

Expected behavior
The schema was parsed and the classes were generated.

@cwacek
Copy link
Owner

cwacek commented Nov 13, 2024

Hey @kurtrwall, I've got a PR that fixes your issue, but it highlighted a different one in the adaptive-card.json schema. Do you happen to know what one is supposed to do with these invalid properties: https://github.com/cwacek/python-jsonschema-objects/pull/301/files#diff-3c302bf352d3c575ff7e419df154d494c77f837be3f00e9e4b350b0ec7d99779R35-R43

As far as I can tell reading the spec, at a minimum you are required to provide the type key for any properties, and those ones are just empty objects. The library is now bailing out attempting to parse the schema because there's no definition.

@cwacek
Copy link
Owner

cwacek commented Nov 13, 2024

This might be a broader issue with Microsoft's AdaptiveCard: microsoft/AdaptiveCards#8943

Going to mark as xfail for now, so I can merge the PR because the underlying issue was real.

cwacek added a commit that referenced this issue Nov 13, 2024
@cwacek cwacek added question pinned Don't mark stale and removed bug labels Nov 13, 2024
@kurtrwall
Copy link
Author

Thanks for looking at this, hopefully they address it soon or at least take a look at that linked issue...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pinned Don't mark stale question
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants