Skip to content

Add support for DNSSEC <info>#56

Draft
gibbz00 wants to merge 15 commits intodjc:mainfrom
gibbz00:dns_sec_info
Draft

Add support for DNSSEC <info>#56
gibbz00 wants to merge 15 commits intodjc:mainfrom
gibbz00:dns_sec_info

Conversation

@gibbz00
Copy link
Contributor

@gibbz00 gibbz00 commented Oct 23, 2024

One step closer to fixing #17

Draft because it relies on the unreleased changes made in djc/instant-xml#70. 😊

I want to remove the various From implementations for CreateData and simply
makes the fields public. I removed the need to create additional constructors
for a UpdateData.

Complex From signatures and implementations that serve only as "constructors"
are in my opinion an antipattern. I don't think it's a sustainable interface to
be consistent with for the remaining commands.

Copy link
Owner

@djc djc left a comment

Choose a reason for hiding this comment

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

I want to remove the various From implementations for CreateData and simply
makes the fields public. I removed the need to create additional constructors
for a UpdateData.

It seems okay to make CreateData::data and both of the DsOrKey fields public.

The commit history in this PR feels fairly fragmented, the individual commit messages don't make it all that clear how they contribute to the overal goal of supporting the info command. Suggest flattening at least to one commit per type with new trait impls.

pub(crate) data: T,
}

macro_rules! from_scalar {
Copy link
Owner

Choose a reason for hiding this comment

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

Can we do this with generics/a wrapper type (potentially inside instant-xml) instead of a macro?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Similar to serde's into and from container attributes? Sure 😊

Self {
data: DsOrKeyType {
maximum_signature_lifetime: Some(maximum_signature_lifetime),
maximum_signature_lifetime: Some(MaximumSignatureLifeTime(
Copy link
Owner

Choose a reason for hiding this comment

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

Can we fix the root cause instead of working around it here?

Copy link
Contributor Author

@gibbz00 gibbz00 Oct 23, 2024

Choose a reason for hiding this comment

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

I would like that too. I tried at first with deseserialize_with, but these need to be specified to:

fn matches(id: Id<'_>, _: Option<Id<'_>>) -> bool {
    id == instant_xml::Id {
        ns: XMLNS,
        name: Self::ELEMENT_NAME,
    }
}

type Accumulator = Option<Self>;
const KIND: instant_xml::Kind = instant_xml::Kind::Scalar;

Perhaps some similar to serdes remote could be used? Set a #[xml(remote = MaximumSignatureLifeTime)] on the field and require a impl Into<Duration> for MaximumSignatureLifeTime

}

#[derive(Debug, ToXml)]
#[derive(Debug, Clone, ToXml, FromXml)]
Copy link
Owner

Choose a reason for hiding this comment

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

I think this is the same thing we discussed yesterday, but not still not fully clear on why these need Clone -- it seems unintuitive.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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