Skip to content

Commit

Permalink
feat: mark project vpc id nullable (#227)
Browse files Browse the repository at this point in the history
  • Loading branch information
byashimov authored Jan 22, 2025
1 parent 64158e7 commit ab093fd
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
4 changes: 3 additions & 1 deletion generator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,9 @@ func fmtStruct(s *Schema) *jen.Statement {

// Adds json tags
tag := jsonName
if !p.required {
if !(p.required || p.Nullable) {
// There are optional nullable fields.
// Which become required in Go.
tag += ",omitempty"
}

Expand Down
1 change: 1 addition & 0 deletions generator/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ type Schema struct {
Ref string `json:"$ref"`
Description string `json:"description"`
CamelName string `json:"for-hash-only!"`
Nullable bool `json:"nullable"`
required bool
name string
propertyNames []string
Expand Down
4 changes: 2 additions & 2 deletions handler/service/service.go

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

10 changes: 10 additions & 0 deletions openapi_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,16 @@ components:
items:
type: string
type: array
ServiceCreateRequestBody:
properties:
project_vpc_id:
# When VPC is not specified, the service will be created in the existing VPC.
# We must send null to create a service in the public network.
nullable: true
ServiceUpdateRequestBody:
properties:
project_vpc_id:
nullable: true
parameters:
service_kafka_quota_user:
in: query
Expand Down

0 comments on commit ab093fd

Please sign in to comment.