Skip to content

fix(go): parsing of uuid in model AreaId in IaaS fails - #289

Merged
marceljk merged 2 commits into
mainfrom
fix/go-sdk-iaas-parsing-uuid-in-area-id-fails
Aug 7, 2026
Merged

fix(go): parsing of uuid in model AreaId in IaaS fails#289
marceljk merged 2 commits into
mainfrom
fix/go-sdk-iaas-parsing-uuid-in-area-id-fails

Conversation

@marceljk

@marceljk marceljk commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Testing instructions

  1. Generate the Go SDK
  2. Add in IaaS v1api, v2beta1api and v2api the following unit test:
func TestAreaId_UnmarshalJSON(t *testing.T) {
	type args struct {
		src []byte
	}
	tests := []struct {
		name    string
		args    args
		wantErr bool
	}{

		{
			name: "success - string d61a8564-c8dd-4ffb-bc15-143e7d0c85ed",
			args: args{
				src: []byte(`"d61a8564-c8dd-4ffb-bc15-143e7d0c85ed"`),
			},
			wantErr: false,
		},
		{
			name: "success - StaticAreaID PUBLIC",
			args: args{
				src: []byte(`"PUBLIC"`),
			},
			wantErr: false,
		},
		{
			name: "success - StaticAreaID SCHWARZ",
			args: args{
				src: []byte(`"SCHWARZ"`),
			},
			wantErr: false,
		},
	}
	for _, tt := range tests {
		t.Run(tt.name, func(t *testing.T) {
			v := &AreaId{}
			if err := v.UnmarshalJSON(tt.args.src); (err != nil) != tt.wantErr {
				t.Errorf("UnmarshalJSON() error = %v, wantErr %v", err, tt.wantErr)
			}
			marshalJson, err := v.MarshalJSON()
			if err != nil {
				t.Fatalf("failed marshalling AreaId: %v", err)
			}
			if string(marshalJson) != string(tt.args.src) {
				t.Fatalf("wanted %s, get %s", tt.args.src, marshalJson)
			}
		})
	}
}
  1. Run the unit tests
    -> Should be successful
  2. OPTIONAL: Checkout the branch oas-bot-31097659889/iaas from the Go SDK (Generator: Update SDK /services/iaas stackit-sdk-go#9754) and do again the steps 2 and 3. This time it will fail

Comment thread scripts/generators/overrides/go/iaas/v1api/v1api_model_area_id.go
Comment thread scripts/generators/overrides/go/iaas/v2api/v2api_model_area_id.go
Co-authored-by: cgoetz-inovex <carlo.goetz@inovex.de>
@marceljk
marceljk merged commit 95422c5 into main Aug 7, 2026
19 checks passed
@marceljk
marceljk deleted the fix/go-sdk-iaas-parsing-uuid-in-area-id-fails branch August 7, 2026 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants