feat(domains): validate TXT record content is enclosed in double quotes#412
Open
delfer wants to merge 3 commits into
Open
feat(domains): validate TXT record content is enclosed in double quotes#412delfer wants to merge 3 commits into
delfer wants to merge 3 commits into
Conversation
added 3 commits
July 21, 2026 11:11
Add CustomizeDiff to domains_rrset_v2 resource that validates TXT records have content wrapped in double quotes. Add unit tests for validateTXTRecordContent and acceptance tests for quoted/unquoted TXT and non-TXT record content.
…tant Remove local variable declarations that shadow the package-level defined in resource_selectel_domains_zone_v2_test.go, fixing linting errors.
takedzoNomad
approved these changes
Jul 22, 2026
|
|
||
| var ErrRRSetNotFound = errors.New("rrset not found") | ||
|
|
||
| func resourceDomainsRRSetV2CustomizeDiff(_ context.Context, d *schema.ResourceDiff, _ interface{}) error { |
There was a problem hiding this comment.
А зачем нам _ аргументы в функции? чтобы не ломать сигнатуру?
Author
There was a problem hiding this comment.
Да, сигнатура должна соответствовать schema.CustomizeDiffFunc, чтобы потом передать в атрибут schema.Resource. При этом параметры context.Context и interface{} для валидации не нужны.
milkrage
reviewed
Jul 23, 2026
|
|
||
| func resourceDomainsRRSetV2CustomizeDiff(_ context.Context, d *schema.ResourceDiff, _ interface{}) error { | ||
| recordType := d.Get("type").(string) | ||
| if recordType != "TXT" { |
Contributor
There was a problem hiding this comment.
- Почему не стал использовать domainsV2.TXT используемый в тестах?
- Пользователь может указать lower case: txt?
|
|
||
| func validateTXTRecordContent(content string) error { | ||
| if len(content) < 2 || content[0] != '"' || content[len(content)-1] != '"' { | ||
| return fmt.Errorf("TXT record content must be enclosed in double quotes, got: %q", content) |
Contributor
There was a problem hiding this comment.
- Необходимо добавить CHANGELOG и описать там, что теперь необходимо указывать:
"\"txt-record-value\"". - Запись контента для TXT записи в формате Multi String, с точки зрения API, возможна?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add CustomizeDiff to domains_rrset_v2 resource that validates TXT records have content wrapped in double quotes. Add unit tests for validateTXTRecordContent and acceptance tests for quoted/unquoted TXT and non-TXT record content.