Field comments include unmeaningful newlines
- Dominant language
- Go
- Stars
- 952
- Forks
- 136
- PR merge metrics
- No merged PRs in 30d
Description
Comments on types correctly have single newlines stripped from them, but comments on fields do not. This is because of the behavior described in the documentation for [`ExtractGoComments`](https://pkg.go.dev/github.com/invopop/jsonschema@v0.7.0#ExtractGoComments):
> When parsing type comments, we use the `go/doc`'s Synopsis method to extract the first phrase only. Field comments, which tend to be much shorter, will include everything.
Synopsis is also the mechanism by which unmeaningful newlines are stripped, so we also lose this behavior for fields.
Related to (but not solved by) #67.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with ExtractGoComments and the linked go/doc Synopsis behavior, comparing how type and field comments are processed. Reproduce the difference described in the issue, then trace the field-comment path to determine where newline handling diverges. Done means field comments handle unmeaningful single newlines consistently with type comments.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100