Skip to content

Commit

Permalink
feat: update
Browse files Browse the repository at this point in the history
  • Loading branch information
ernado committed Jun 23, 2024
1 parent aa11ac5 commit 6ca9948
Show file tree
Hide file tree
Showing 21 changed files with 56,004 additions and 23,633 deletions.
3,506 changes: 3,033 additions & 473 deletions _oas/openapi.json

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion botdoc/extract.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func Extract(doc *goquery.Document) (a API) {
}
}
appendDefinition := func() {
if d.Name == "" {
if d.Name == "" || strings.Contains(d.Name, " ") {
d = Definition{}
return
}
Expand Down Expand Up @@ -113,6 +113,8 @@ func Extract(doc *goquery.Document) (a API) {
`Telegram clients currently support the following`,
`Currently, the following`,
`This object represents one result of`,
`Currently, it can be one of`,
`It can be one of`,
} {
if strings.Contains(d.RawText, sumMarker) {
probablySum = true
Expand Down
14 changes: 8 additions & 6 deletions botdoc/oas.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func (a API) typeOAS(f Field) *ogen.Schema {
p.Ref = "#/components/schemas/" + t.Name
case KindArray:
p.Type = "array"
p.Items = a.typeOAS(Field{Type: *t.Item})
p.Items = &ogen.Items{Item: a.typeOAS(Field{Type: *t.Item})}
default:
switch t.String() {
case "Integer or String":
Expand Down Expand Up @@ -339,7 +339,7 @@ Schemas:
p := a.fieldOAS(s, f)
oneOf := p.OneOf
if p.Items != nil {
oneOf = p.Items.OneOf
oneOf = p.Items.Item.OneOf
}
var d *ogen.Discriminator
for _, s := range oneOf {
Expand All @@ -362,7 +362,7 @@ Schemas:
}
}
if p.Items != nil {
p.Items.Discriminator = df
p.Items.Item.Discriminator = df
} else {
p.Discriminator = df
}
Expand Down Expand Up @@ -415,8 +415,10 @@ Schemas:
)
c.Schemas[resultName] = resultFor(&ogen.Schema{
Type: "array",
Items: &ogen.Schema{
Ref: itemName,
Items: &ogen.Items{
Item: &ogen.Schema{
Ref: itemName,
},
},
})
addResponse(resultName, "#/components/schemas/"+resultName, "Result of method invocation")
Expand Down Expand Up @@ -534,7 +536,7 @@ func patchSchema(spec *ogen.Spec) *ogen.Spec {
}
setItemsFormat := func(typeName, propName, format string) {
updateProperty(typeName, propName, func(p *ogen.Property) {
p.Schema.Items.Format = format
p.Schema.Items.Item.Format = format
})
}
// MTProto uses int64, use it in BotAPI too to reduce copying.
Expand Down
59 changes: 31 additions & 28 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,52 +1,55 @@
module github.com/gotd/botapi

go 1.18
go 1.21.0

toolchain go1.22.0

require (
github.com/PuerkitoBio/goquery v1.8.1
github.com/go-chi/chi/v5 v5.0.8
github.com/go-faster/errors v0.6.1
github.com/PuerkitoBio/goquery v1.9.2
github.com/go-chi/chi/v5 v5.0.14
github.com/go-faster/errors v0.7.1
github.com/go-faster/jx v1.1.0
github.com/gotd/td v0.87.0
github.com/ogen-go/ogen v0.68.6
github.com/stretchr/testify v1.8.4
go.etcd.io/bbolt v1.3.7
go.opentelemetry.io/otel v1.18.0
go.opentelemetry.io/otel/metric v1.18.0
go.opentelemetry.io/otel/trace v1.18.0
github.com/gotd/td v0.104.0
github.com/ogen-go/ogen v1.2.1
github.com/stretchr/testify v1.9.0
go.etcd.io/bbolt v1.3.10
go.opentelemetry.io/otel v1.27.0
go.opentelemetry.io/otel/metric v1.27.0
go.opentelemetry.io/otel/trace v1.27.0
go.uber.org/multierr v1.11.0
go.uber.org/zap v1.26.0
golang.org/x/sync v0.3.0
go.uber.org/zap v1.27.0
golang.org/x/sync v0.7.0
)

require (
github.com/andybalholm/cascadia v1.3.1 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/andybalholm/cascadia v1.3.2 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dlclark/regexp2 v1.10.0 // indirect
github.com/fatih/color v1.15.0 // indirect
github.com/dlclark/regexp2 v1.11.0 // indirect
github.com/fatih/color v1.17.0 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-faster/xor v1.0.0 // indirect
github.com/go-faster/yaml v0.4.6 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-playground/validator/v10 v10.4.1 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gotd/ige v0.2.2 // indirect
github.com/gotd/neo v0.1.5 // indirect
github.com/klauspost/compress v1.16.7 // indirect
github.com/klauspost/compress v1.17.9 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.19 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/segmentio/asm v1.2.0 // indirect
go.uber.org/atomic v1.11.0 // indirect
golang.org/x/crypto v0.13.0 // indirect
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1 // indirect
golang.org/x/net v0.15.0 // indirect
golang.org/x/sys v0.12.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/crypto v0.24.0 // indirect
golang.org/x/exp v0.0.0-20230725093048-515e97ebf090 // indirect
golang.org/x/mod v0.18.0 // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/tools v0.22.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
nhooyr.io/websocket v1.8.7 // indirect
nhooyr.io/websocket v1.8.11 // indirect
rsc.io/qr v0.2.0 // indirect
)
Loading

0 comments on commit 6ca9948

Please sign in to comment.