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

schema/attribute: introduce explicit IsOptional field #1

Merged
merged 1 commit into from
Nov 10, 2020

Conversation

radeksimko
Copy link
Member

This is to differentiate between fields which are
computed-only (IsComputed: true, IsOptional: false)
and computed + optional (IsComputed: true, IsOptional: true).

Technically we could assume IsOptional: true when IsComputed: false,
but that would likely make a future serialization story more complex
and introduce potential confusion for callers where they may just read
raw struct field, instead of going through some functions
which set the defaults.

This is to differentiate between fields which are
computed-only (IsComputed: true, IsOptional: false)
and computed + optional (IsComputed: true, IsOptional: true).

Technically we could assume IsOptional: true when IsComputed: false,
but that would likely make a future serialization story more complex
and introduce potential confusion for callers where they may just read
raw struct field, instead of going through some functions
which set the defaults.
@radeksimko radeksimko requested a review from a team November 9, 2020 18:48
radeksimko added a commit to hashicorp/terraform-schema that referenced this pull request Nov 9, 2020
radeksimko added a commit to hashicorp/terraform-schema that referenced this pull request Nov 9, 2020
radeksimko added a commit to hashicorp/terraform-schema that referenced this pull request Nov 9, 2020
@radeksimko radeksimko merged commit 4e41292 into main Nov 10, 2020
@radeksimko radeksimko deleted the f-explicit-optional branch November 10, 2020 07:12
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.

2 participants