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

Allow newtype pattern instead of type aliasing #44

Closed
SebastienGllmt opened this issue Jul 21, 2022 · 2 comments · Fixed by #88
Closed

Allow newtype pattern instead of type aliasing #44

SebastienGllmt opened this issue Jul 21, 2022 · 2 comments · Fixed by #88

Comments

@SebastienGllmt
Copy link
Collaborator

SebastienGllmt commented Jul 21, 2022

Suppose you have the following CDDL

protocolMagic = u32

(I think this happens on anything that's a primitive?)

Current behavior

type ProtocolMagic = u32;

(Occasionally) Desired behavior

#[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd, serde::Serialize, serde::Deserialize, JsonSchema)]
pub struct ProtocolMagic(pub u32);
@rooooooooob
Copy link
Collaborator

How do we want to specify for which types this happens? A flag like --newtypes=protocolMagic,otherType? or a switch on/off globally?

@SebastienGllmt
Copy link
Collaborator Author

yeah not to sure how we want to do this since a global flag doesn't seem so helpful either, but we didn't build any way to annotate codegen hints in comments either

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 a pull request may close this issue.

2 participants