You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 385f3e2
Browse filesBrowse the repository at this point in the historyBrowse files
fix(builders): don't fail a scan over a declaration that cannot be read
A package served from compiled export data has types and no syntax, so asking
for the declaration of one of its types answers nothing. Four builder sites
treated that as fatal and ended the scan: a `time.Duration` field, an
`io.Writer`, a `reflect.Type`, and the schema builder's own entry point. The
whole document was lost over prose that was never going to be there.
Those sites degrade now. The type is rendered from what the type-checker knows —
which is everything except the comments — and a scan.sourceless-type warning
says which type it was, where the field is, and what was given up. Losing a
description a dependency happened to carry is a small, stated cost; losing the
spec is not. The author's own annotations always win, so a `swagger:description`
override is the answer where the prose matters.
The asymmetry is closed too: a definition that goes missing altogether — rather
than merely thinning — warns on the same code, so nothing disappears in silence.
What stays unrendered is a model declared in a dependency that carries no
annotation anywhere: the marker scan passes over it, correctly, and the
definition collapses to a bare `x-go-name`. Reading back every dependency
outside the standard library instead brings the definition back EMPTY and
without the warning, because struct fields are located by position and an
export-data object and a separately parsed file are two token.File entries for
one filename. Closing it needs a name-based field bridge in the schema builder,
so it is written down where it would be retried, and CompiledDependencies stays
opt-in and experimental until it is.
Also records what the standard-library recognizer set deliberately leaves out. A
recognizer asserts that a type means one thing on the wire wherever it appears,
so one may only be added where that holds for every use. `time.Duration` is the
case that invites it: a count of nanoseconds, where whether an API means
nanoseconds, seconds or an ISO 8601 string is the author's decision rather than
a property of the type. That is what strfmt.Duration exists for, and teaching
the set to guess would take the choice away.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
0 commit comments