Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated ints to be integers #43

Merged
merged 2 commits into from
Dec 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,7 @@ paths:
schema:
description: The pageSize field.
format: int32
type: number
type: integer
- in: query
name: page_token
schema:
Expand Down
6 changes: 4 additions & 2 deletions internal/apigw/apigw_openapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ type route struct {
Method string
}

const SchemaProxyRefPrefix = "#/components/schemas/"

func (module *Module) buildOpenAPI(ctx pgsgo.Context, in pgs.Service) (*dm_v3.Document, error) {
doc := &dm_v3.Document{
Version: "3.1.0",
Expand Down Expand Up @@ -365,7 +367,7 @@ func (mt *msgTracker) AddInput(m pgs.Message, filter []string) *dm_base.SchemaPr
mt.messages[fqn] = &schemaData{path: fqn, msg: m, filter: filter}
}

return dm_base.CreateSchemaProxyRef("#/components/schemas/" + fqn)
return dm_base.CreateSchemaProxyRef(SchemaProxyRefPrefix + fqn)
}

func (mt *msgTracker) Add(m pgs.Message) *dm_base.SchemaProxy {
Expand All @@ -374,7 +376,7 @@ func (mt *msgTracker) Add(m pgs.Message) *dm_base.SchemaProxy {
}
fqn := nicerFQN(m)
mt.messages[fqn] = &schemaData{path: fqn, msg: m}
return dm_base.CreateSchemaProxyRef("#/components/schemas/" + fqn)
return dm_base.CreateSchemaProxyRef(SchemaProxyRefPrefix + fqn)
}

func contains[T comparable](needle T, haystack []T) bool {
Expand Down
4 changes: 2 additions & 2 deletions internal/apigw/apigw_openapi_scalar.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func (sc *schemaContainer) schemaForScalar(pt pgs.ProtoType) *dm_base.Schema {
}
case pgs.Int32T, pgs.SFixed32, pgs.SInt32:
return &dm_base.Schema{
Type: []string{"number"},
Type: []string{"integer"},
Format: "int32",
}
case pgs.UInt64T, pgs.Fixed64T:
Expand All @@ -29,7 +29,7 @@ func (sc *schemaContainer) schemaForScalar(pt pgs.ProtoType) *dm_base.Schema {
}
case pgs.UInt32T, pgs.Fixed32T:
return &dm_base.Schema{
Type: []string{"number"},
Type: []string{"integer"},
Format: "uint32",
}
case pgs.StringT:
Expand Down
4 changes: 2 additions & 2 deletions internal/apigw/apigw_openapi_schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func (sc *schemaContainer) Message(m pgs.Message, filter []string, nullable *boo
}

if sc.schemas[fqn] != nil {
return dm_base.CreateSchemaProxyRef("#/components/schemas/" + fqn)
return dm_base.CreateSchemaProxyRef(SchemaProxyRefPrefix + fqn)
}

description := &strings.Builder{}
Expand Down Expand Up @@ -158,7 +158,7 @@ func (sc *schemaContainer) Message(m pgs.Message, filter []string, nullable *boo
obj.Description = description.String()
rv := dm_base.CreateSchemaProxy(obj)
sc.schemas[fqn] = rv
return dm_base.CreateSchemaProxyRef("#/components/schemas/" + fqn)
return dm_base.CreateSchemaProxyRef(SchemaProxyRefPrefix + fqn)
}

func (sc *schemaContainer) OneOf(of pgs.OneOf) []*dm_base.SchemaProxy {
Expand Down
4 changes: 2 additions & 2 deletions internal/apigw/apigw_openapi_wkt.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ func (sc *schemaContainer) schemaForWKT(wkt pgs.WellKnownType) *dm_base.Schema {
}
case pgs.Int32ValueWKT:
return &dm_base.Schema{
Type: []string{"number"},
Type: []string{"integer"},
Format: "int32",
Nullable: oasTrue(),
}
case pgs.UInt32ValueWKT:
return &dm_base.Schema{
Type: []string{"number"},
Type: []string{"integer"},
Format: "int64",
Nullable: oasTrue(),
}
Expand Down
Loading