Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Document "ExactlyOneOf" Behavior and interaction with Sensitive fields #259

Open
AaronME opened this issue Mar 9, 2022 · 1 comment
Open
Labels
bug Something isn't working wontfix This will not be worked on

Comments

@AaronME
Copy link

AaronME commented Mar 9, 2022

What happened?

We attempted to implement ExactlyOneOf for a set of fields in our Resource. After make generate, both fields in the ExactlyOneOf list were marked as "required."

We are not clear on the desired behavior of setting this field. Does OpenApiV3Schema support ExactlyOneOf validation?

How can we reproduce it?

We added two fields to our schema:

		r.TerraformResource.Schema["data_string"] = &schema.Schema{
			Type:         schema.TypeString,
			Sensitive:    true,
			ExactlyOneOf: []string{"data_json", "data_string"},
			Description:  comment.String(),
		}
		r.TerraformResource.Schema["data_json"] = &schema.Schema{
			Type:         schema.TypeString,
			Sensitive:    true,
			ExactlyOneOf: []string{"data_json", "data_string"},
			Description:  comment.String(),
		}

After code generation, these fields were both required:

                  dataJsonSecretRef:
                    description: JSON-encoded secret data to write.
                    properties:
                      key:
                        description: The key to select.
                        type: string
                      name:
                        description: Name of the secret.
                        type: string
                      namespace:
                        description: Namespace of the secret.
                        type: string
                    required:
                    - key
                    - name
                    - namespace
                    type: object
                  dataStringSecretRef:
                    description: String that will be written as the secret data at
                      the given path.
                    properties:
                      key:
                        description: The key to select.
                        type: string
                      name:
                        description: Name of the secret.
                        type: string
                      namespace:
                        description: Namespace of the secret.
                        type: string
                    required:
                    - key
                    - name
                    - namespace
                    type: object
                required:
                - dataJsonSecretRef
                - dataStringSecretRef

Submitting with one field or the other returned validation errors for the missing field.

@AaronME AaronME added the bug Something isn't working label Mar 9, 2022
@stale
Copy link

stale bot commented Aug 13, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix This will not be worked on label Aug 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

1 participant