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

NEW FEATURE: variables in number fields #100

Merged
merged 6 commits into from
Feb 3, 2025

Conversation

pawel-kow
Copy link
Member

Adresses issue #88

@pawel-kow
Copy link
Member Author

@kerolasa @lianapanatau-ionos @wdbaker-godaddy please take look here as well if this update makes sense to you

@kerolasa
Copy link
Collaborator

kerolasa commented Aug 1, 2024

Just to be explicit the string-number-variables can be expressed in template three different ways, and these need to be equal (assuming variable expansion results to same numeric value).

"ttl": 3600
"ttl": "3600"
"ttl": "%var%"

After a template is processed the value MUST to be numeric. I think that's right, right?

@pawel-kow
Copy link
Member Author

@kerolasa correct. Is there any edit to the text needed to make it clear?

@kerolasa
Copy link
Collaborator

kerolasa commented Aug 2, 2024

The Int or string representation of Int is probably good enough. I will try to make dc-template-linter to work with int-string-variables sometime soon(ish).

kerolasa added a commit to Domain-Connect/dc-template-linter that referenced this pull request Aug 5, 2024
After this change numbers are always quoted after reformatting.  That is the
only way to be somewhat consistent what is the representation format when
%variables% need to be supported, and they need to be strings.

As a practical example, one could have the following in a template (and it
would fail, but it's obvious why - see the hostname).

    "records": [
        {
            "type": "A",
            "host": "the-ttl-is-plain-number-this-is-ok",
            "ttl": 1800
        },
        {
            "type": "A",
            "host": "the-ttl-is-quoted-number-this-is-ok",
            "ttl": "8100"
        },
        {
            "type": "A",
            "host": "the-ttl-is-variable-this-is-ok",
            "ttl": "%varttl%"
        },
        {
            "type": "A",
            "host": "ttl-is-BROKEN-it-cannot-be-just-a-string",
            "ttl": "just-a-string"
        }
    ]

Reference: Domain-Connect/spec#100
Signed-off-by: Sami Kerola <[email protected]>
Copy link
Collaborator

@kerolasa kerolasa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When this is merged I need to merge the dc-template-linter change to sync the tooling with the spec.

kerolasa added a commit to Domain-Connect/dc-template-linter that referenced this pull request Aug 14, 2024
After this change numbers are always quoted after reformatting.  That is the
only way to be somewhat consistent what is the representation format when
%variables% need to be supported, and they need to be strings.

As a practical example, one could have the following in a template (and it
would fail, but it's obvious why - see the hostname).

    "records": [
        {
            "type": "A",
            "host": "the-ttl-is-plain-number-this-is-ok",
            "ttl": 1800
        },
        {
            "type": "A",
            "host": "the-ttl-is-quoted-number-this-is-ok",
            "ttl": "8100"
        },
        {
            "type": "A",
            "host": "the-ttl-is-variable-this-is-ok",
            "ttl": "%varttl%"
        },
        {
            "type": "A",
            "host": "ttl-is-BROKEN-it-cannot-be-just-a-string",
            "ttl": "just-a-string"
        }
    ]

Reference: Domain-Connect/spec#100
Signed-off-by: Sami Kerola <[email protected]>
@jkolker-godaddy
Copy link

I have reviewed with DEV and they will approve the pull request.

Copy link

@wdbaker-godaddy wdbaker-godaddy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved based on JK comment

@pawel-kow
Copy link
Member Author

This change is now under community vote: https://domainconnect.slack.com/archives/CBTKX8R4G/p1736188710187489
Finish: Jan 20

pawel-kow added a commit that referenced this pull request Feb 3, 2025
@pawel-kow pawel-kow merged commit bc8082d into master Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants