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

Expose pb options to ocaml types #234

Merged
merged 4 commits into from
Jan 17, 2024

Conversation

Lupus
Copy link
Contributor

@Lupus Lupus commented Jan 16, 2024

Bonus commit includes extracting enum value options out of the parser, they were just ignored previously 😊

A special plugin is introduced, which dumps internal representation of OCaml type tree as comments to resulting target .ml file. It server two purposes - (1) produces output for expect tests, as it dumps options associated with various types, and this ensures that options are parsed and transferred correctly between compilation stages; and (2) it serves as an aid for custom plugin developers, as looking at this dump is really helpful before writing any code to actually pattern match the OCaml type tree and generate something out of it.

I already have implemented a prototype-level plugin that generates validation rules out of PGV annotations, having protobuf options exposed along with OCaml type tree is a hard requirement for such kinds of plugins.

@c-cube c-cube merged commit 55fc03b into mransan:master Jan 17, 2024
2 checks passed
@c-cube
Copy link
Collaborator

c-cube commented Jan 17, 2024

Thank you, this is indeed going to be handy in tandem with expect tests!

@Lupus Lupus deleted the expose-pb-options-to-ocaml-types branch January 17, 2024 07:42
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