From 58007cfdb58537d093779d2fe59dccfac208bcd1 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Sat, 9 Nov 2024 21:26:56 -0500 Subject: [PATCH 1/2] chore: adds unit test to demonstrate guid normalization --- request_information_test.go | 39 ++++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/request_information_test.go b/request_information_test.go index 4c390c5..0460e5c 100644 --- a/request_information_test.go +++ b/request_information_test.go @@ -5,6 +5,7 @@ import ( "testing" "time" + "github.com/google/uuid" "github.com/microsoft/kiota-abstractions-go/store" "github.com/microsoft/kiota-abstractions-go/internal" @@ -24,6 +25,7 @@ type QueryParameters struct { Top *int32 Status *internal.PersonStatus `uriparametername:"status"` Statuses []internal.PersonStatus `uriparametername:"statuses"` + Id *uuid.UUID } func TestItAddsStringQueryParameters(t *testing.T) { @@ -97,13 +99,36 @@ func TestItSetsTheRawURL(t *testing.T) { } type getQueryParameters struct { - Count *bool `uriparametername:"%24count"` - Expand []string `uriparametername:"%24expand"` - Select_escaped []string `uriparametername:"%24select"` - Filter *string `uriparametername:"%24filter"` - Orderby []string `uriparametername:"%24orderby"` - Search *string `uriparametername:"%24search"` - Number []int64 `uriparametername:"%24number"` + Count *bool `uriparametername:"%24count"` + Expand []string `uriparametername:"%24expand"` + Select_escaped []string `uriparametername:"%24select"` + Filter *string `uriparametername:"%24filter"` + Orderby []string `uriparametername:"%24orderby"` + Search *string `uriparametername:"%24search"` + Number []int64 `uriparametername:"%24number"` + Id *uuid.UUID `uriparametername:"id"` +} + +func TestItSetsUUIDQueryParameters(t *testing.T) { + requestInformation := NewRequestInformation() + requestInformation.UrlTemplate = "http://localhost/users{?id}" + value := uuid.MustParse("95E943B8-52D5-4228-902D-61D65792CED7") + requestInformation.AddQueryParameters(getQueryParameters{ + Id: &value, + }) + resultUri, err := requestInformation.GetUri() + assert.Nil(t, err) + assert.Equal(t, "http://localhost/users?id=95e943b8-52d5-4228-902d-61d65792ced7", resultUri.String()) +} + +func TestItSetsUUIDPathParameters(t *testing.T) { + requestInformation := NewRequestInformation() + requestInformation.UrlTemplate = "http://localhost/users/{id}" + value := uuid.MustParse("95E943B8-52D5-4228-902D-61D65792CED7") + requestInformation.PathParametersAny["id"] = &value + resultUri, err := requestInformation.GetUri() + assert.Nil(t, err) + assert.Equal(t, "http://localhost/users/95e943b8-52d5-4228-902d-61d65792ced7", resultUri.String()) } func TestItSetsNumberArrayQueryParameters(t *testing.T) { From 214f2734088cad04c0271c056b88819592bffab9 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Sat, 9 Nov 2024 21:35:26 -0500 Subject: [PATCH 2/2] fix: adds workflow dispatch to codeql workflow Signed-off-by: Vincent Biret --- .github/workflows/codeql-analysis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index bd64251..33008ff 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -19,6 +19,7 @@ on: branches: [ main ] schedule: - cron: '40 16 * * 3' + workflow_dispatch: jobs: analyze: