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

Generate documentation of SQL tables #1623

Merged
merged 3 commits into from
Jun 20, 2024

Conversation

slinkydeveloper
Copy link
Contributor

Fix #980

Copy link
Contributor

@igalshilman igalshilman left a comment

Choose a reason for hiding this comment

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

LGTM

Comment on lines 18 to 21
id "The ID of the service deployment.": DataType::LargeUtf8,
ty "The type of the endpoint. Either `http` or `lambda`.": DataType::LargeUtf8,
endpoint "The address of the endpoint. Either HTTP URL or Lambda ARN.": DataType::LargeUtf8,
created_at "Timestamp indicating the deployment registration time.": DataType::Date64,
Copy link
Contributor

Choose a reason for hiding this comment

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

The syntax adds a lot of inline noise. Maybe an alternative is to move this to be a comment on every field instead.

Copy link
Contributor

Choose a reason for hiding this comment

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

I like this idea. It is a bit similar to how clap does it for the command line options, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Initially I thought this was not possible, that's why i went with the string literal. But this article https://stackoverflow.com/questions/53890817/macro-rule-for-matching-a-doc-comment has a solution for it, let me test this solution and get back to that.

Copy link
Contributor

Choose a reason for hiding this comment

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

I will try to finish this PR while slinkydeveloper is on vacation to avoid PR rot.

@tillrohrmann
Copy link
Contributor

I've pushed an update to incorporate @AhmedSoliman's idea to use Rust docs instead.

Copy link
Contributor

@igalshilman igalshilman left a comment

Choose a reason for hiding this comment

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

LGTM, I like the comment style improvement!

key: DataType::LargeUtf8,

/// Only contains meaningful values when a service stores state as `utf8`. This is the case for
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks amazing!

@AhmedSoliman
Copy link
Contributor

Looks a lot better. The only thing I'd suggest (potentially for a future PR) is to consider an alternative to the match per table name when generating the docs.

To test it: `cargo xtask generate-table-docs`

Unrelated fix to some dependencies that broke my build locally.

Use Rust doc for documenting DF table schemas
@tillrohrmann
Copy link
Contributor

Looks a lot better. The only thing I'd suggest (potentially for a future PR) is to consider an alternative to the match per table name when generating the docs.

Good point. I'll look whether there is an easy solution for it.

@tillrohrmann
Copy link
Contributor

I briefly looked into using linkme or inventory for automatically register the different table schemas at compile/before main time. Unfortunately, both seem to not properly work on MacOS because of dtolnay/linkme#61. A way to solve it would be to require at least lto = "thin" for the dev profile so that xtask will see the different elements. I stopped at this point and will leave it as a future task to properly figure it out.

This commit changes the place where the table docs need to be registered
to be included in the automatic table docs generation to a single place.
This commit updates the sql table column descriptions wrt feedback
from restatedev/documentation#422.
@tillrohrmann tillrohrmann merged commit b1b6806 into restatedev:main Jun 20, 2024
6 checks passed
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.

Generate documentation for introspection tables
4 participants