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

AttributeError not parsing schema correctly. #376

Closed
blade2005 opened this issue Jan 4, 2024 · 2 comments
Closed

AttributeError not parsing schema correctly. #376

blade2005 opened this issue Jan 4, 2024 · 2 comments
Labels
bug Something isn't working requires-jsonschema-changes Needs changes or new features in the jsonschema library

Comments

@blade2005
Copy link

I use Taskfile a lot and want to make sure my yaml files are correct.

Fortunately there's this project and Taskfile publishes their schema

Save the below as poc.Taskfile.yaml

version: 3
tasks:
  default:
    cmds:
      - echo hi
      - defer: echo bye
      - echo hi again

Run the following

pipx run check-jsonschema --verbose --schemafile https://taskfile.dev/schema.json poc.Taskfile.yaml

output

Running the task works fine indicating the application sees it as a valid file

$ task -t poc.Taskfile.yaml
task: [default] echo hi
hi
task: [default] echo hi again
hi again
task: [default] echo bye
bye

The error seems to be focused around the defer line. If I comment out the line with the defer jsonschema says it's valid.

@sirosen sirosen added bug Something isn't working requires-jsonschema-changes Needs changes or new features in the jsonschema library labels Jan 4, 2024
@sirosen
Copy link
Member

sirosen commented Jan 4, 2024

I'm pretty sure this is an upstream bug in the way that referencing is handling things -- I was able to reproduce the error pretty quickly, so thanks for providing a detailed reproducer!

My guess, offhand, is that the schema has some error in it, and referencing doesn't handle the bad data gracefully. I'll dig into it and follow-up with the upstreams to get this resolved.

@sirosen
Copy link
Member

sirosen commented Jan 17, 2024

I've reported this upstream to referencing and to task. We can follow along on those trackers, but I think there's nothing more to do here, in this project. Once there are upstream fixes, in either place, we'll start to see improvements.

task needs to define good data (else there's nothing to do here 🤷 ), and for referencing and jsonschema, I think we may have options to improve the error which is emitted. But that improvement probably comes with a performance cost, so I'm not going to push hard for it if it meets resistance.

@sirosen sirosen closed this as completed Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working requires-jsonschema-changes Needs changes or new features in the jsonschema library
Projects
None yet
Development

No branches or pull requests

2 participants