Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.

Commit 6ca9948

Browse files
committed
feat: update
1 parent aa11ac5 commit 6ca9948

21 files changed

+56004
-23633
lines changed

_oas/openapi.json

Lines changed: 3033 additions & 473 deletions
Large diffs are not rendered by default.

botdoc/extract.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func Extract(doc *goquery.Document) (a API) {
3434
}
3535
}
3636
appendDefinition := func() {
37-
if d.Name == "" {
37+
if d.Name == "" || strings.Contains(d.Name, " ") {
3838
d = Definition{}
3939
return
4040
}
@@ -113,6 +113,8 @@ func Extract(doc *goquery.Document) (a API) {
113113
`Telegram clients currently support the following`,
114114
`Currently, the following`,
115115
`This object represents one result of`,
116+
`Currently, it can be one of`,
117+
`It can be one of`,
116118
} {
117119
if strings.Contains(d.RawText, sumMarker) {
118120
probablySum = true

botdoc/oas.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ func (a API) typeOAS(f Field) *ogen.Schema {
106106
p.Ref = "#/components/schemas/" + t.Name
107107
case KindArray:
108108
p.Type = "array"
109-
p.Items = a.typeOAS(Field{Type: *t.Item})
109+
p.Items = &ogen.Items{Item: a.typeOAS(Field{Type: *t.Item})}
110110
default:
111111
switch t.String() {
112112
case "Integer or String":
@@ -339,7 +339,7 @@ Schemas:
339339
p := a.fieldOAS(s, f)
340340
oneOf := p.OneOf
341341
if p.Items != nil {
342-
oneOf = p.Items.OneOf
342+
oneOf = p.Items.Item.OneOf
343343
}
344344
var d *ogen.Discriminator
345345
for _, s := range oneOf {
@@ -362,7 +362,7 @@ Schemas:
362362
}
363363
}
364364
if p.Items != nil {
365-
p.Items.Discriminator = df
365+
p.Items.Item.Discriminator = df
366366
} else {
367367
p.Discriminator = df
368368
}
@@ -415,8 +415,10 @@ Schemas:
415415
)
416416
c.Schemas[resultName] = resultFor(&ogen.Schema{
417417
Type: "array",
418-
Items: &ogen.Schema{
419-
Ref: itemName,
418+
Items: &ogen.Items{
419+
Item: &ogen.Schema{
420+
Ref: itemName,
421+
},
420422
},
421423
})
422424
addResponse(resultName, "#/components/schemas/"+resultName, "Result of method invocation")
@@ -534,7 +536,7 @@ func patchSchema(spec *ogen.Spec) *ogen.Spec {
534536
}
535537
setItemsFormat := func(typeName, propName, format string) {
536538
updateProperty(typeName, propName, func(p *ogen.Property) {
537-
p.Schema.Items.Format = format
539+
p.Schema.Items.Item.Format = format
538540
})
539541
}
540542
// MTProto uses int64, use it in BotAPI too to reduce copying.

go.mod

Lines changed: 31 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,55 @@
11
module github.com/gotd/botapi
22

3-
go 1.18
3+
go 1.21.0
4+
5+
toolchain go1.22.0
46

57
require (
6-
github.com/PuerkitoBio/goquery v1.8.1
7-
github.com/go-chi/chi/v5 v5.0.8
8-
github.com/go-faster/errors v0.6.1
8+
github.com/PuerkitoBio/goquery v1.9.2
9+
github.com/go-chi/chi/v5 v5.0.14
10+
github.com/go-faster/errors v0.7.1
911
github.com/go-faster/jx v1.1.0
10-
github.com/gotd/td v0.87.0
11-
github.com/ogen-go/ogen v0.68.6
12-
github.com/stretchr/testify v1.8.4
13-
go.etcd.io/bbolt v1.3.7
14-
go.opentelemetry.io/otel v1.18.0
15-
go.opentelemetry.io/otel/metric v1.18.0
16-
go.opentelemetry.io/otel/trace v1.18.0
12+
github.com/gotd/td v0.104.0
13+
github.com/ogen-go/ogen v1.2.1
14+
github.com/stretchr/testify v1.9.0
15+
go.etcd.io/bbolt v1.3.10
16+
go.opentelemetry.io/otel v1.27.0
17+
go.opentelemetry.io/otel/metric v1.27.0
18+
go.opentelemetry.io/otel/trace v1.27.0
1719
go.uber.org/multierr v1.11.0
18-
go.uber.org/zap v1.26.0
19-
golang.org/x/sync v0.3.0
20+
go.uber.org/zap v1.27.0
21+
golang.org/x/sync v0.7.0
2022
)
2123

2224
require (
23-
github.com/andybalholm/cascadia v1.3.1 // indirect
24-
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
25+
github.com/andybalholm/cascadia v1.3.2 // indirect
26+
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
2527
github.com/davecgh/go-spew v1.1.1 // indirect
26-
github.com/dlclark/regexp2 v1.10.0 // indirect
27-
github.com/fatih/color v1.15.0 // indirect
28+
github.com/dlclark/regexp2 v1.11.0 // indirect
29+
github.com/fatih/color v1.17.0 // indirect
2830
github.com/ghodss/yaml v1.0.0 // indirect
2931
github.com/go-faster/xor v1.0.0 // indirect
3032
github.com/go-faster/yaml v0.4.6 // indirect
31-
github.com/go-logr/logr v1.2.4 // indirect
33+
github.com/go-logr/logr v1.4.1 // indirect
3234
github.com/go-logr/stdr v1.2.2 // indirect
33-
github.com/go-playground/validator/v10 v10.4.1 // indirect
34-
github.com/google/uuid v1.3.0 // indirect
35+
github.com/google/uuid v1.6.0 // indirect
3536
github.com/gotd/ige v0.2.2 // indirect
3637
github.com/gotd/neo v0.1.5 // indirect
37-
github.com/klauspost/compress v1.16.7 // indirect
38+
github.com/klauspost/compress v1.17.9 // indirect
3839
github.com/mattn/go-colorable v0.1.13 // indirect
39-
github.com/mattn/go-isatty v0.0.19 // indirect
40+
github.com/mattn/go-isatty v0.0.20 // indirect
4041
github.com/pmezard/go-difflib v1.0.0 // indirect
4142
github.com/segmentio/asm v1.2.0 // indirect
4243
go.uber.org/atomic v1.11.0 // indirect
43-
golang.org/x/crypto v0.13.0 // indirect
44-
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 // indirect
45-
golang.org/x/net v0.15.0 // indirect
46-
golang.org/x/sys v0.12.0 // indirect
47-
golang.org/x/text v0.13.0 // indirect
44+
golang.org/x/crypto v0.24.0 // indirect
45+
golang.org/x/exp v0.0.0-20230725093048-515e97ebf090 // indirect
46+
golang.org/x/mod v0.18.0 // indirect
47+
golang.org/x/net v0.26.0 // indirect
48+
golang.org/x/sys v0.21.0 // indirect
49+
golang.org/x/text v0.16.0 // indirect
50+
golang.org/x/tools v0.22.0 // indirect
4851
gopkg.in/yaml.v2 v2.4.0 // indirect
4952
gopkg.in/yaml.v3 v3.0.1 // indirect
50-
nhooyr.io/websocket v1.8.7 // indirect
53+
nhooyr.io/websocket v1.8.11 // indirect
5154
rsc.io/qr v0.2.0 // indirect
5255
)

0 commit comments

Comments
 (0)