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

Extend scalegen to detect cyclic dependencies when generating encode/decode methods #61

Open
fasmat opened this issue Jun 20, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@fasmat
Copy link
Member

fasmat commented Jun 20, 2023

With #44 scalegen was extended to limit the maximum depth of nested types when encoding and decoding types.

Scalegen should also by default not generate code for types that contain cyclic dependencies on each other, e.g.:

type Message struct {
    Sigs []Signatures
}

type Signature struct {
    Message Message
}

This leads to messages that are arbitrarily large and is usually bad design.

Possibly a configurable parameter can be added that would allow the generation of encode & decode methods for types with cyclic dependencies but this should require the user to explicitly allow it and still print a warning during code generation.

@fasmat fasmat added the enhancement New feature or request label Jun 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant