Skip to content

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

Open
marceljk wants to merge 1 commit into
mainfrom
fix/go-sdk-iaas-parsing-uuid-in-area-id-fails
Open

fix(go): parsing of uuid in model AreaId in IaaS fails#289
marceljk wants to merge 1 commit 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

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.

1 participant