Skip to content

Fix spec validation & merge so that default values are correctly applied - #72

Merged
shykes merged 1 commit into
mainfrom
fix-spec-defaults
Jan 27, 2021
Merged

shykes merged 1 commit into
mainfrom
fix-spec-defaults

Conversation

@shykes

@shykes shykes commented Jan 25, 2021 •

Copy link
Copy Markdown
Contributor

Fixes #19.

  • Operations with omitted fields are correctly expanded to their default values, if available. For example {do: “exec”} is expanded to {do: “exec”, path: “/“}, etc.

  • When a script is missing inputs (in cue terms, some values in the script are “not concrete”), print a more user-friendly message. (NOTE: more improvements coming in a separate PR)

  • Change in spec validation behavior: if an operation is missing required fields (for example a fetch-container with no ref), it will NOT be caught as an error. Rather, it will be considered a “missing input”, causing the script to interrupt without error, and notifying the user. NOTE: this can be changed in the future, but will require more work to avoid breaking other validation scenarios in the process.

@shykes
shykes requested a review from aluzzardi January 25, 2021 23:27
@shykes
shykes force-pushed the fix-spec-defaults branch 2 times, most recently from 9b38b7a to 9dbc12d Compare January 26, 2021 18:58
@shykes shykes changed the title (WORK IN PROGRESS) Fix spec validation & merge so that default values are correctly applied Fix spec validation & merge so that default values are correctly applied Jan 26, 2021
@shykes

shykes commented Jan 26, 2021

Copy link
Copy Markdown
Contributor Author

This fixes #19 .

Comment thread dagger/gen.go Resolved
Comment thread dagger/script.go Resolved
Comment thread dagger/script.go Resolved
Comment thread dagger/value.go Resolved
Comment thread examples/tests/exec/always/main.cue Resolved
@shykes
shykes force-pushed the fix-spec-defaults branch from 04c899b to 09e9cfa Compare January 26, 2021 20:27
@shykes
shykes requested a review from aluzzardi January 26, 2021 23:52
@shykes

shykes commented Jan 26, 2021

Copy link
Copy Markdown
Contributor Author

Ready for another round.

@shykes
shykes force-pushed the fix-spec-defaults branch from 09e9cfa to 6dbb30f Compare January 26, 2021 23:56
@shykes

shykes commented Jan 26, 2021

Copy link
Copy Markdown
Contributor Author

Rebased & changed one of @dubo-dubon-duponey ‘s new integration tests to match the new validation behavior: although a #dagger: random_key: _ is not allowed, this: #dagger: #randomDef: _ IS allowed.

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.

Validation issue with optional fields

2 participants