May 7, 2025

Jacob Zimmerman

We released a “V2” of the Go SDK generator, with a completely redesigned JSON model, more ergonomic union types, and a cleaner DX across the board.

  • No need for pkg.F(…) constructors

    • petstore.Pet{ Name: petstore.F("Joey") }petstore.Pet{ Name: "Joey" }

  • Pointer-free JSON model using omitzero: Ergonomic optional and nullable parameters using the new standard library omitzero JSON semantics.

  • Improved discoverability of union variants: Unions now use a struct-based design with json:",omitzero,inline" semantics instead of interfaces for better discoverability

  • Ergonomic access to shared fields in union types: No need to switch on variants when you know the property you want

  • Automatic helper generation for complex union variants:

// Old: Manually constructed variants

openai.ChatCompletionNewParams{
   	Messages: openai.F([]openai.ChatCompletionMessageParam{
   		openai.ChatCompletionUserMessageParam{
     		Content: openai.F([]openai.ChatCompletionMessageContent{
       			openai.UnionString("Write me a poem")
       		}),
		Type: openai.F[ChatCompletionMessageParamRole]("user"),
    }),
    Model: openai.ChatModelO3Mini,
}

// New: Automatically generated helpers

openai.ChatCompletionNewParams{
	Messages: []openai.ChatCompletionMessageParamUnion{
		openai.UserMessage("Write me a poem"),
	},
	Model: openai.ChatModelO3Mini

// New: Automatically generated helpers

openai.ChatCompletionNewParams{
		Messages: []openai.ChatCompletionMessageParamUnion{
			openai.UserMessage("How can I list all files in a directory using Python?"),
		},
		Model: openai.ChatModelO3Mini

May 7, 2025

Jacob Zimmerman

We released a “V2” of the Go SDK generator, with a completely redesigned JSON model, more ergonomic union types, and a cleaner DX across the board.

  • No need for pkg.F(…) constructors

    • petstore.Pet{ Name: petstore.F("Joey") }petstore.Pet{ Name: "Joey" }

  • Pointer-free JSON model using omitzero: Ergonomic optional and nullable parameters using the new standard library omitzero JSON semantics.

  • Improved discoverability of union variants: Unions now use a struct-based design with json:",omitzero,inline" semantics instead of interfaces for better discoverability

  • Ergonomic access to shared fields in union types: No need to switch on variants when you know the property you want

  • Automatic helper generation for complex union variants:

// Old: Manually constructed variants

openai.ChatCompletionNewParams{
   	Messages: openai.F([]openai.ChatCompletionMessageParam{
   		openai.ChatCompletionUserMessageParam{
     		Content: openai.F([]openai.ChatCompletionMessageContent{
       			openai.UnionString("Write me a poem")
       		}),
		Type: openai.F[ChatCompletionMessageParamRole]("user"),
    }),
    Model: openai.ChatModelO3Mini,
}

// New: Automatically generated helpers

openai.ChatCompletionNewParams{
	Messages: []openai.ChatCompletionMessageParamUnion{
		openai.UserMessage("Write me a poem"),
	},
	Model: openai.ChatModelO3Mini

// New: Automatically generated helpers

openai.ChatCompletionNewParams{
		Messages: []openai.ChatCompletionMessageParamUnion{
			openai.UserMessage("How can I list all files in a directory using Python?"),
		},
		Model: openai.ChatModelO3Mini

May 7, 2025

Jacob Zimmerman

We released a “V2” of the Go SDK generator, with a completely redesigned JSON model, more ergonomic union types, and a cleaner DX across the board.

  • No need for pkg.F(…) constructors

    • petstore.Pet{ Name: petstore.F("Joey") }petstore.Pet{ Name: "Joey" }

  • Pointer-free JSON model using omitzero: Ergonomic optional and nullable parameters using the new standard library omitzero JSON semantics.

  • Improved discoverability of union variants: Unions now use a struct-based design with json:",omitzero,inline" semantics instead of interfaces for better discoverability

  • Ergonomic access to shared fields in union types: No need to switch on variants when you know the property you want

  • Automatic helper generation for complex union variants:

// Old: Manually constructed variants

openai.ChatCompletionNewParams{
   	Messages: openai.F([]openai.ChatCompletionMessageParam{
   		openai.ChatCompletionUserMessageParam{
     		Content: openai.F([]openai.ChatCompletionMessageContent{
       			openai.UnionString("Write me a poem")
       		}),
		Type: openai.F[ChatCompletionMessageParamRole]("user"),
    }),
    Model: openai.ChatModelO3Mini,
}

// New: Automatically generated helpers

openai.ChatCompletionNewParams{
	Messages: []openai.ChatCompletionMessageParamUnion{
		openai.UserMessage("Write me a poem"),
	},
	Model: openai.ChatModelO3Mini

// New: Automatically generated helpers

openai.ChatCompletionNewParams{
		Messages: []openai.ChatCompletionMessageParamUnion{
			openai.UserMessage("How can I list all files in a directory using Python?"),
		},
		Model: openai.ChatModelO3Mini

Mar 17, 2025

Jacob Zimmerman

Users can now set global default values for path and query parameters via client options in the Go SDK.

Mar 17, 2025

Jacob Zimmerman

Users can now set global default values for path and query parameters via client options in the Go SDK.

Mar 17, 2025

Jacob Zimmerman

Users can now set global default values for path and query parameters via client options in the Go SDK.