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

feat: Extract comments from Java code #2788

Merged
merged 7 commits into from
Sep 24, 2024
Merged

feat: Extract comments from Java code #2788

merged 7 commits into from
Sep 24, 2024

Conversation

tomdaffurn
Copy link
Contributor

@tomdaffurn tomdaffurn commented Sep 23, 2024

Extract comments from Java code for Verbs, Data, Enum, Config, and Secrets

Closes #2417

Schema for the test data module is:

module javacomments {
  // Config comment
  config config String
  // Secret comment
  secret secretString String
  
  // Comment on a data class.
  export data DataClass {
    field String
  }
  export data EnumType {
    name String
    ordinal Int
  }
  
  // Comment on a verb
  export verb MultilineCommentVerb(javacomments.DataClass) javacomments.EnumType
}

@tomdaffurn tomdaffurn requested review from a team and worstell and removed request for a team September 23, 2024 07:25
@github-actions github-actions bot changed the title Extract comments from Java code feat: Extract comments from Java code Sep 23, 2024
@ftl-robot ftl-robot mentioned this pull request Sep 23, 2024
@alecthomas
Copy link
Collaborator

Nice! Can we also remove the @param entries?

@tomdaffurn
Copy link
Contributor Author

Nice! Can we also remove the @param entries?

@alecthomas We can. Do you want to strip all javadoc tags, or just ones that've been extracted for config and secrets?

Copy link
Collaborator

@stuartwdouglas stuartwdouglas left a comment

Choose a reason for hiding this comment

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

Awesome!

@alecthomas
Copy link
Collaborator

Nice! Can we also remove the @param entries?

@alecthomas We can. Do you want to strip all javadoc tags, or just ones that've been extracted for config and secrets?

I think we should delete them, I can't see how they could be useful outside the context of the JVM?

@tomdaffurn
Copy link
Contributor Author

I think we should delete them, I can't see how they could be useful outside the context of the JVM?

👍 :

  • We could be losing significant info by dropping them. Not uncommon for a @param and @return tags to be detailed
  • For JVM-JVM dependencies, it would make for full-featured, idiomatic comments

👎 :

  • They are ugly and not going to be supported by FTL or Go tooling
  • If we're opinionated in dropping them, then Java verb authors will adapt and write comments in a style compatible with all languages

👉 I will delete them. Make a list of common tags and strip them out.

@alecthomas
Copy link
Collaborator

We could potentially reconstruct them for the JVM where it makes sense?

@tomdaffurn
Copy link
Contributor Author

We could potentially reconstruct them for the JVM where it makes sense?

Yeah. Can take comments from the schema for params that FTL has knowledge of: Config, Secrets, the body param, verb clients

@stuartwdouglas
Copy link
Collaborator

Some tags will potentially loose information if you delete them, it is not uncommon to have link or code tags in the middle of a sentence, that will no longer make sense if it is removed. Is there a plan for the schema comments to support any sort of markup language? Markdown comments would be kinda cool.

@alecthomas
Copy link
Collaborator

No plan but that would be very cool.

@tomdaffurn
Copy link
Contributor Author

OK, I added tag stripping, and a TODO to extract more info into a potential markdown/rich format schema comment system.

@tomdaffurn tomdaffurn enabled auto-merge (squash) September 24, 2024 04:31
@tomdaffurn tomdaffurn merged commit 093902a into main Sep 24, 2024
91 checks passed
@tomdaffurn tomdaffurn deleted the tom/jvm-commments branch September 24, 2024 04:41
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.

Improve comment capture in Java for the Schema
3 participants