Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update std-uritemplate to v2.0.0 #1489

Merged
merged 6 commits into from
Dec 19, 2024
Merged

fix: update std-uritemplate to v2.0.0 #1489

merged 6 commits into from
Dec 19, 2024

Conversation

musale
Copy link
Contributor

@musale musale commented Nov 18, 2024

Closes #1384

Updates the std-uritemplate package to v2.0.0. No further code changes required

private normalizeValue(value: unknown): unknown {
if (value instanceof DateOnly || value instanceof TimeOnly) {
return value.toString();
}
if (value instanceof Date) {
return value.toISOString();
}
if (Array.isArray(value)) {
return value.map((val) => this.normalizeValue(val));
}
return value;
}

and passing tests

it("should correctly handle custom type in query/path parameter", () => {
const expected: string = `http://localhost/users/33933a8d-32bb-c6a8-784a-f60b5a1dd66a/2021-12-12?objectId=83afbf49-5583-152c-d7fb-176105d518bc&startDate=2021-12-12&startTime=23%3A12%3A00.0000000&timeStamp=2024-06-11T00%3A00%3A00.000Z`;
const requestInformation = new RequestInformation(HttpMethod.GET);
requestInformation.pathParameters["baseurl"] = baseUrl;
requestInformation.pathParameters["userId"] = parseGuidString("33933a8d-32bb-c6a8-784a-f60b5a1dd66a");
requestInformation.pathParameters["date"] = DateOnly.parse("2021-12-12");
requestInformation.urlTemplate = "http://localhost/users/{userId}/{date}{?objectId,startDate,startTime,endDate,endTime,timeStamp}";
requestInformation.setQueryStringParametersFromRawObject<GetQueryParameters>({ objectId: parseGuidString("83afbf49-5583-152c-d7fb-176105d518bc"), startDate: new DateOnly({ year: 2021, month: 12, day: 12 }), startTime: new TimeOnly({ hours: 23, minutes: 12 }), timeStamp: new Date("2024-06-11T00:00:00.000Z") }, getQueryParameterMapper);
assert.equal(requestInformation.URL, expected);
});

Copy link
Member

@baywet baywet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the contribution!

From the quoted normalization, I think we're missing duration. Would you mind adding it please?

Signed-off-by: Vincent Biret <[email protected]>
@baywet baywet enabled auto-merge December 19, 2024 18:52
@baywet baywet merged commit cf12831 into main Dec 19, 2024
16 checks passed
@baywet baywet deleted the feat/drop-nativedate branch December 19, 2024 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done ✔️
Development

Successfully merging this pull request may close these issues.

prepare for std uri template 2 and date time drop
2 participants