Skip to content
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
4 changes: 2 additions & 2 deletions DOCUMENTATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -1326,7 +1326,7 @@ type CheckoutsCreateApplePaySessionParams struct {
CheckoutsCreateApplePaySessionResponse is a schema definition.

```go
type CheckoutsCreateApplePaySessionResponse json.RawMessage
type CheckoutsCreateApplePaySessionResponse = json.RawMessage
```

<a name="CheckoutsCreateParams"></a>
Expand Down Expand Up @@ -5801,7 +5801,7 @@ type TransactionsRefundParams struct {
TransactionsRefundResponse is a schema definition.

```go
type TransactionsRefundResponse json.RawMessage
type TransactionsRefundResponse = json.RawMessage
```

<a name="Unauthorized"></a>
Expand Down
2 changes: 1 addition & 1 deletion checkouts.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ type TypeDeclaration struct {
Name string
// Type describes the type of the type (e.g. struct, int64, string)
Type string
// Alias indicates whether the declaration aliases Type instead of defining a new type.
Alias bool
// Fields holds the information for the field
Fields []StructField
// Comment holds the description of the type
Expand Down
1 change: 1 addition & 0 deletions internal/cmd/codegen/pkg/builder/transform.go
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ func (b *Builder) generateSchemaComponents(name string, schema *base.SchemaProxy
Comment: schemaGodoc(name, spec),
Type: "json.RawMessage",
Name: name,
Alias: !isErr,
Schema: spec,
}
types = append(types, typ)
Expand Down
6 changes: 5 additions & 1 deletion internal/cmd/codegen/pkg/builder/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ func (tt *TypeDeclaration) String() string {
if tt.Comment != "" {
fmt.Fprintf(buf, "// %s\n", tt.Comment)
}
fmt.Fprintf(buf, "type %s %s", tt.Name, tt.Type)
fmt.Fprintf(buf, "type %s ", tt.Name)
if tt.Alias {
fmt.Fprint(buf, "= ")
}
fmt.Fprint(buf, tt.Type)
if tt.Fields != nil {
slices.SortFunc(tt.Fields, func(a, b StructField) int {
return strings.Compare(a.Name, b.Name)
Expand Down
2 changes: 1 addition & 1 deletion transactions.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.