Any and scalar: strings like "Nan", "T", "007" stop being strings
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
Direzione di ricerca
Start by reading GetAnyConverter and GetScalarConverter in tt.go, then the parsing functions named in converter.go. Check the existing tests for these converters and run them to see how the current behavior is covered. Done means the listed ambiguous values stay strings for any and scalar, explicitly typed fields retain their permissive parsing, and the behavior change is documented; clarify whether a factory option is needed.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Reproduction snippets assume:
fac := tupleconv.MakeStringToTTConvFactory()
Where: GetAnyConverter (tt.go:174), GetScalarConverter (tt.go:188), StringToFloatConverter (converter.go:146), StringToBoolConverter (converter.go:98).
any and scalar try number, decimal, boolean... before string, and the underlying strconv functions are very permissive:
ParseFloatacceptsnan,inf,infinityin any case.ParseBoolacceptst,T,f,F,1,0,TRUE,True...ParseUintdrops leading zeros,ParseIntaccepts a leading+.
So names, codes and phone numbers are silently turned into other types.
Reproduction:
for _, s := range []string{"Nan", "inf", "T", "f", "007", "+79991234567"} {
v, err := fac.GetScalarConverter().Convert(s)
fmt.Printf("%q -> %T(%v) %v\n", s, v, v, err)
}
"Nan" -> float64(NaN) <nil>
"inf" -> float64(+Inf) <nil>
"T" -> bool(true) <nil>
"f" -> bool(false) <nil>
"007" -> uint64(7) <nil>
"+79991234567" -> int64(79991234567) <nil>
GetAnyConverter gives the same results.
Expected: for any/scalar, only unambiguous literals change type; the values above stay strings.
Suggested fix: use a stricter grammar for any/scalar: no nan/inf, no leading +, no leading zeros except 0 itself, and only true/false for booleans. Explicitly typed fields (double, boolean...) may keep the permissive parsing. This changes behavior, so it needs a CHANGELOG entry and possibly an option on the factory.
- Lingua principale
- Go
- Stelle
- 1
- Fork
- 0
- Merge medio
- 1h 43m
- PR unite (30g)
- 2
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di tarantool/go-tupleconv
-
build issue code health
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
tarantool/go-tupleconv#27 ·
-
code health
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
tarantool/go-tupleconv#26 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
tarantool/go-tupleconv#25 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
tarantool/go-tupleconv#23 ·
-
documentation
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
tarantool/go-tupleconv#22 ·
Tutte le issue di tarantool/go-tupleconv
Issue simili
-
agent-research-finding chore
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
jordansmall/spindrift#7370 ·
I maintainer di solito rispondono entro 1 giorno
-
☢️ Bug v3
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
The repo's gates check is clean and runs need no swapsForse già presa @turbot-agent-fleet l’ha presa oggi. Apertaagent:ready
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
turbot/tailpipe#677 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
needs-kind needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 2 giorni
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
crossplane-contrib/provider-keycloak#806 ·
I maintainer di solito rispondono entro 1 giorno