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: defer keyword in json schema #1288

Closed
wants to merge 1 commit into from

Conversation

calvinmclean
Copy link
Contributor

This fixes a few issues with JSON schema validation when using the defer keyword.
It adds a defer_call object that is used alongside cmd_call and for_call. Then, defer is removed from the cmd_call.

Example Taskfile:

version: "3"

tasks:
  integration-test:
    desc: Startup docker resources and run integration tests. Cleanup when done.
    dir: ./garden-app
    cmds:
      - docker compose -f ../deploy/docker-compose.yml --profile test up -d
      - defer: docker volume rm deploy_influxdb
      - defer: docker compose -f ../deploy/docker-compose.yml --profile test down
      - sleep 15
      - go test -race -covermode=atomic -coverprofile=integration_coverage.out -coverpkg=./... ./integration_tests

Errors:

Incorrect type. Expected "boolean".
Missing property "cmd".

Screenshot 2023-07-30 at 21 03 31
Screenshot 2023-07-30 at 21 03 39

@ydarma
Copy link

ydarma commented Aug 8, 2023

Actually the correct type seems to be "#/definitions/3/cmd"

@andreynering andreynering added the area: json schema Changes related to the JSON schema. label Aug 10, 2023
@andreynering
Copy link
Member

Merged with adjustments at c42bc69. Thank you both!

We should not use #/definitions/3/cmd here because defer is only a subset of that. I needed to add support for defer: { task: foobar }, though.

@calvinmclean calvinmclean deleted the fix/defer-jsonschema branch August 10, 2023 04:25
@mjpieters
Copy link

mjpieters commented Nov 5, 2024

The defer call object takes a vars keyword too, but the schema is lacking this.

I thought that perhaps this should have been a reference to #/definitions/task_call, but since deferred calls don't support silent or for that would be wrong too.

@mjpieters
Copy link

I've opened #1907 to address this, and to update the schema reference documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: json schema Changes related to the JSON schema.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants