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

Use inline comment if no other comment is available #94

Merged
merged 3 commits into from
Sep 28, 2023

Conversation

evilnoxx
Copy link

I needed to generate jsonschema to document some code generated using protoc.

The protobuf files were already documented like so:

message Event {
    string id = 1;  // the id of the event
    string name = 2; // name of the event
}

And protoc generates a struct like so:

type RuleEvent struct {
	state         protoimpl.MessageState
	sizeCache     protoimpl.SizeCache
	unknownFields protoimpl.UnknownFields

	Id   string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`     // the id of the event
	Name string `protobuf:"bytes,5,opt,name=name,proto3" json:"name,omitempty"` // name of the event
}

The purpose of this pull request is to use the inline comments if the field comment is not available.
If the field comment is available, then the inline comment is still ignored.

Copy link
Contributor

@samlown samlown left a comment

Choose a reason for hiding this comment

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

Thanks for this! Looks great!

@samlown samlown merged commit 2bf120d into invopop:main Sep 28, 2023
2 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.

2 participants