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

Validate missing path params #1322

Merged
merged 7 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/abstractions/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@microsoft/kiota-abstractions",
"version": "1.0.0-preview.60",
"version": "1.0.0-preview.61",
"description": "Core abstractions for kiota generated libraries in TypeScript and JavaScript",
"main": "dist/es/src/index.js",
"module": "dist/es/src/index.js",
Expand Down
6 changes: 5 additions & 1 deletion packages/abstractions/src/apiClientProxifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,11 @@ export const apiClientProxifier = <T extends object>(requestAdapter: RequestAdap
if (navigationCandidate.pathParametersMappings && navigationCandidate.pathParametersMappings.length > 0) {
for (let i = 0; i < argArray.length; i++) {
const element = argArray[i];
downWardPathParameters[navigationCandidate.pathParametersMappings[i]] = element;
if (element) {
andrueastman marked this conversation as resolved.
Show resolved Hide resolved
downWardPathParameters[navigationCandidate.pathParametersMappings[i]] = element;
} else {
throw new Error(`path parameter ${navigationCandidate.pathParametersMappings[i]} cannot be undefined`);
}
}
}
return apiClientProxifier(requestAdapter, downWardPathParameters, navigationCandidate.navigationMetadata, navigationCandidate.requestsMetadata);
Expand Down
2 changes: 1 addition & 1 deletion packages/authentication/azure/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@microsoft/kiota-authentication-azure",
"version": "1.0.0-preview.55",
"version": "1.0.0-preview.56",
"description": "Authentication provider for Kiota using Azure Identity",
"main": "dist/es/src/index.js",
"module": "dist/es/src/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/authentication/spfx/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@microsoft/kiota-authentication-spfx",
"version": "1.0.0-preview.49",
"version": "1.0.0-preview.50",
"description": "Authentication provider for using Kiota in SPFx solutions",
"main": "dist/es/src/index.js",
"module": "dist/es/src/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/bundle/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@microsoft/kiota-bundle",
"version": "1.0.0-preview.3",
"version": "1.0.0-preview.4",
"description": "Kiota Bundle package providing default implementations for client setup for kiota generated libraries in TypeScript and JavaScript",
"main": "dist/es/src/index.js",
"module": "dist/es/src/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/http/fetch/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@microsoft/kiota-http-fetchlibrary",
"version": "1.0.0-preview.59",
"version": "1.0.0-preview.60",
"description": "Kiota request adapter implementation with fetch",
"keywords": [
"Kiota",
Expand Down
2 changes: 1 addition & 1 deletion packages/serialization/form/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@microsoft/kiota-serialization-form",
"version": "1.0.0-preview.49",
"version": "1.0.0-preview.50",
"description": "Implementation of Kiota Serialization interfaces for URI from encoded",
"main": "dist/es/src/index.js",
"browser": {
Expand Down
2 changes: 1 addition & 1 deletion packages/serialization/json/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@microsoft/kiota-serialization-json",
"version": "1.0.0-preview.60",
"version": "1.0.0-preview.61",
"description": "Implementation of Kiota Serialization interfaces for JSON",
"main": "dist/es/src/index.js",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion packages/serialization/multipart/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@microsoft/kiota-serialization-multipart",
"version": "1.0.0-preview.38",
"version": "1.0.0-preview.39",
"description": "Implementation of Kiota Serialization interfaces for multipart form data",
"main": "dist/es/src/index.js",
"module": "dist/es/src/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/serialization/text/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@microsoft/kiota-serialization-text",
"version": "1.0.0-preview.57",
"version": "1.0.0-preview.58",
"description": "Implementation of Kiota Serialization interfaces for text",
"main": "dist/es/src/index.js",
"browser": {
Expand Down
5 changes: 5 additions & 0 deletions packages/test/tests/getTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ import { proxyClient, userId } from "./testClient";
import { assert, describe, it } from "vitest";

describe("TestGet", () => {
it("should validate empty params in indexer", async () => {
assert.throws(() => proxyClient.users.byUserId("").messages.byMessageId("").toGetRequestInformation(), "path parameter user%2Did cannot be undefined");
assert.throws(() => proxyClient.users.byUserId("").messages.byMessageId("").toGetRequestInformation(), "path parameter user%2Did cannot be undefined");
assert.throws(() => proxyClient.users.byUserId("sample").messages.byMessageId("").toGetRequestInformation(), "path parameter message%2Did cannot be undefined");
});
it("should return a test", async () => {
const messages = await proxyClient.users.byUserId(userId).messages.get();
assert.isDefined(messages?.value);
Expand Down
Loading