From a9b20a0bd0a63bc6e95f37598746f9fe0e88d0b8 Mon Sep 17 00:00:00 2001
From: Tsuf Cohen <39455181+tsuf239@users.noreply.github.com>
Date: Sun, 26 May 2024 15:55:34 +0300
Subject: [PATCH] fix(sdk): api path- collision with `/{proxy+}` (#6543)
fixed:
#5943
#5210
tf-aws
aws-cdk
(the delete test passed in the next run- it was only failing because something in the env couldn't be destroyed)
and the cycle one doesn't work on main as well :)
## Checklist
- [x] Title matches [Winglang's style guide](https://www.winglang.io/contributing/start-here/pull_requests#how-are-pull-request-titles-formatted)
- [ ] Description explains motivation and solution
- [ ] Tests added (always)
- [ ] Docs updated (only required for features)
- [ ] Added `pr/e2e-full` label if this feature requires end-to-end testing
*By submitting this pull request, I confirm that my contribution is made under the terms of the [Wing Cloud Contribution License](https://github.com/winglang/wing/blob/main/CONTRIBUTION_LICENSE.md)*.
---
examples/tests/sdk_tests/api/post.test.w | 28 +-
.../tests/sdk_tests/api/root_path_vars.test.w | 51 +++
examples/tests/valid/api_valid_path.test.w | 18 +-
libs/awscdk/src/api.ts | 20 +-
.../test/__snapshots__/api.test.ts.snap | 12 +-
libs/wingsdk/src/cloud/api.ts | 60 ++-
libs/wingsdk/src/shared-aws/api.default.ts | 21 +-
libs/wingsdk/src/target-tf-aws/api.ts | 7 +-
libs/wingsdk/test/target-sim/api.test.ts | 59 ++-
.../__snapshots__/api.test.ts.snap | 4 +-
.../api/post.test.w_compile_tf-aws.md | 64 +--
.../root_path_vars.test.w_compile_tf-aws.md | 265 +++++++++++++
.../api/root_path_vars.test.w_test_sim.md | 12 +
.../api_valid_path.test.w_compile_tf-aws.md | 375 ++++++++++++------
14 files changed, 803 insertions(+), 193 deletions(-)
create mode 100644 examples/tests/sdk_tests/api/root_path_vars.test.w
create mode 100644 tools/hangar/__snapshots__/test_corpus/sdk_tests/api/root_path_vars.test.w_compile_tf-aws.md
create mode 100644 tools/hangar/__snapshots__/test_corpus/sdk_tests/api/root_path_vars.test.w_test_sim.md
diff --git a/examples/tests/sdk_tests/api/post.test.w b/examples/tests/sdk_tests/api/post.test.w
index a1a7a95406b..65a8016bed9 100644
--- a/examples/tests/sdk_tests/api/post.test.w
+++ b/examples/tests/sdk_tests/api/post.test.w
@@ -1,15 +1,16 @@
bring cloud;
bring http;
bring util;
+bring expect;
let api = new cloud.Api();
let body = Json {"cat": "Tion"};
-api.post("/path", inflight (req: cloud.ApiRequest): cloud.ApiResponse => {
- assert(req.method == cloud.HttpMethod.POST);
- assert(req.path == "/path");
- assert(req.body == Json.stringify(body));
- assert(req.headers?.get("content-type") == "application/json");
+api.post("/", inflight (req: cloud.ApiRequest): cloud.ApiResponse => {
+ expect.equal(req.method, cloud.HttpMethod.POST);
+ expect.equal(req.path, "/");
+ expect.equal(req.body, Json.stringify(body));
+ expect.equal(req.headers?.get("content-type"), "application/json");
return cloud.ApiResponse {
status: 200,
@@ -19,15 +20,14 @@ api.post("/path", inflight (req: cloud.ApiRequest): cloud.ApiResponse => {
test "http.post and http.fetch can preform a call to an api" {
- let url = api.url + "/path";
- let response: http.Response = http.post(url, headers: { "content-type" => "application/json" }, body: Json.stringify(body));
- let fetchResponse: http.Response = http.post(url, method: http.HttpMethod.POST, headers: { "content-type" => "application/json" }, body: Json.stringify(body));
+ let response: http.Response = http.post(api.url, headers: { "content-type" => "application/json" }, body: Json.stringify(body));
+ let fetchResponse: http.Response = http.post(api.url, method: http.HttpMethod.POST, headers: { "content-type" => "application/json" }, body: Json.stringify(body));
- assert(response.body == Json.stringify(body));
- assert(response.status == 200);
- assert(response.url == url);
+ expect.equal(response.body , Json.stringify(body));
+ expect.equal(response.status , 200);
+ expect.match(response.url , api.url);
- assert(fetchResponse.body == Json.stringify(body));
- assert(fetchResponse.status == 200);
- assert(fetchResponse.url == url);
+ expect.equal(fetchResponse.body , Json.stringify(body));
+ expect.equal(fetchResponse.status , 200);
+ expect.match(fetchResponse.url , api.url);
}
diff --git a/examples/tests/sdk_tests/api/root_path_vars.test.w b/examples/tests/sdk_tests/api/root_path_vars.test.w
new file mode 100644
index 00000000000..c769d94d1fa
--- /dev/null
+++ b/examples/tests/sdk_tests/api/root_path_vars.test.w
@@ -0,0 +1,51 @@
+bring cloud;
+bring http;
+bring expect;
+
+let api = new cloud.Api();
+
+let handler = inflight (req: cloud.ApiRequest): cloud.ApiResponse => {
+ return {
+ body: "id is {req.vars.tryGet("id") ?? "unknown"}",
+ };
+};
+
+api.get("/:id", handler);
+api.get("/:id/comments", handler);
+
+
+try {
+ // sibling path same method
+ api.get("/:username/something", handler);
+ expect.equal(false);
+} catch e {
+ expect.equal(e, "Endpoint for path '/:username/something' and method 'GET' conflicts with existing sibling endpoint for path '/:id'- try to match the parameter names to avoid this error.");
+}
+
+try {
+ // sibling path different method
+ api.post("/:username", handler);
+ expect.equal(false);
+} catch e {
+ expect.equal(e, "Endpoint for path '/:username' and method 'POST' conflicts with existing sibling endpoint for path '/:id'- try to match the parameter names to avoid this error.");
+}
+
+
+
+test "path vars at endpoint root are working as expected" {
+ let resWithId = http.get("{api.url}/123");
+ expect.ok(resWithId.ok);
+ expect.equal(resWithId.body, "id is 123");
+
+ let resWithComments = http.get("{api.url}/123/comments");
+ expect.ok(resWithComments.ok);
+ expect.equal(resWithComments.body, "id is 123");
+
+ let unknownRes = http.get("{api.url}/123/comments/unknown-path");
+ expect.equal(unknownRes.status, 404);
+ expect.match(unknownRes.body, "Error");
+
+ let unknownRes2 = http.get("{api.url}/123/unknown-path");
+ expect.equal(unknownRes2.status, 404);
+ expect.match(unknownRes2.body, "Error");
+}
\ No newline at end of file
diff --git a/examples/tests/valid/api_valid_path.test.w b/examples/tests/valid/api_valid_path.test.w
index 46057ad4379..127fdf9c006 100644
--- a/examples/tests/valid/api_valid_path.test.w
+++ b/examples/tests/valid/api_valid_path.test.w
@@ -1,7 +1,7 @@
bring cloud;
+bring expect;
-let api = new cloud.Api();
-
+let api = new cloud.Api() as "default api";
let handler = inflight (req: cloud.ApiRequest): cloud.ApiResponse => {
return cloud.ApiResponse {
@@ -10,25 +10,26 @@ let handler = inflight (req: cloud.ApiRequest): cloud.ApiResponse => {
};
};
-let testInvalidPath = (path:str) => {
+let testInvalidPath = (path:str, apiInstance: cloud.Api?) => {
let var error = "";
let expected = "Invalid path {path}. Url parts can only contain alpha-numeric chars, \"-\", \"_\" and \".\". Params can only contain alpha-numeric chars and \"_\".";
try {
- api.get(path, handler);
+ (apiInstance ?? api).get(path, handler);
} catch e {
error = e;
}
- assert(error == expected);
+ expect.equal(error, expected);
};
-let testValidPath = (path:str) => {
+
+let testValidPath = (path:str, apiInstance: cloud.Api?) => {
let var error = "";
try {
- api.get(path, handler);
+ (apiInstance ?? api).get(path, handler);
} catch e {
error = e;
}
- assert(error == "");
+ expect.equal(error, "");
};
//invalid paths
@@ -65,3 +66,4 @@ testValidPath("/test/segment1/:param1/segment2?query1=value1?query2=value2");
testValidPath("/test/segment1/segment2?query=value1&query2=value2");
testValidPath("/test/path.withDots");
testValidPath("/test/path/.withDots/:param/:param-dash/x");
+testValidPath("/", new cloud.Api() as "api for root path");
diff --git a/libs/awscdk/src/api.ts b/libs/awscdk/src/api.ts
index c4194fbfac8..2672668d115 100644
--- a/libs/awscdk/src/api.ts
+++ b/libs/awscdk/src/api.ts
@@ -10,8 +10,12 @@ import { CfnPermission } from "aws-cdk-lib/aws-lambda";
import { Construct } from "constructs";
import { App } from "./app";
import { cloud, core, std } from "@winglang/sdk";
-import { ApiEndpointHandler, IAwsApi, STAGE_NAME } from "@winglang/sdk/lib/shared-aws/api";
-import { API_DEFAULT_RESPONSE } from "@winglang/sdk/lib/shared-aws/api.default";
+import {
+ ApiEndpointHandler,
+ IAwsApi,
+ STAGE_NAME,
+} from "@winglang/sdk/lib/shared-aws/api";
+import { createApiDefaultResponse } from "@winglang/sdk/lib/shared-aws/api.default";
import { isAwsCdkFunction } from "./function";
/**
@@ -201,7 +205,10 @@ export class Api extends cloud.Api implements IAwsApi {
): cloud.Function {
let handler = this.handlers[inflight._id];
if (!handler) {
- const newInflight = ApiEndpointHandler.toFunctionHandler(inflight, Api.renderCorsHeaders(this.corsOptions)?.defaultResponse);
+ const newInflight = ApiEndpointHandler.toFunctionHandler(
+ inflight,
+ Api.renderCorsHeaders(this.corsOptions)?.defaultResponse
+ );
const prefix = `${method.toLowerCase()}${path.replace(/\//g, "_")}_}`;
handler = new cloud.Function(
this,
@@ -277,13 +284,16 @@ class WingRestApi extends Construct {
super(scope, id);
this.region = (App.of(this) as App).region;
- const defaultResponse = API_DEFAULT_RESPONSE(props.cors);
-
this.api = new SpecRestApi(this, `${id}`, {
apiDefinition: ApiDefinition.fromInline(
Lazy.any({
produce: () => {
const injectGreedy404Handler = (openApiSpec: cloud.OpenApiSpec) => {
+ const defaultResponse = createApiDefaultResponse(
+ Object.keys(openApiSpec.paths),
+ props.cors
+ );
+
openApiSpec.paths = {
...openApiSpec.paths,
...defaultResponse,
diff --git a/libs/awscdk/test/__snapshots__/api.test.ts.snap b/libs/awscdk/test/__snapshots__/api.test.ts.snap
index 11461e1654a..7511f433311 100644
--- a/libs/awscdk/test/__snapshots__/api.test.ts.snap
+++ b/libs/awscdk/test/__snapshots__/api.test.ts.snap
@@ -809,7 +809,7 @@ exports[`api with 'name' & 'age' parameter 1`] = `
},
},
},
- "/{proxy+}": {
+ "/{name}/{age}/{proxy+}": {
"x-amazon-apigateway-any-method": {
"produces": [
"application/json",
@@ -910,7 +910,7 @@ exports[`api with 'name' & 'age' parameter 1`] = `
"Type": "AWS::IAM::Role",
"UpdateReplacePolicy": "Retain",
},
- "Apiapideployment63AA90064db664b7f484d24bf9fd7531027f96a0": {
+ "Apiapideployment63AA90060cf4119fbf39ca17a86ecca447cf30c8": {
"DeletionPolicy": "Retain",
"Properties": {
"RestApiId": {
@@ -960,7 +960,7 @@ exports[`api with 'name' & 'age' parameter 1`] = `
],
"Properties": {
"DeploymentId": {
- "Ref": "Apiapideployment63AA90064db664b7f484d24bf9fd7531027f96a0",
+ "Ref": "Apiapideployment63AA90060cf4119fbf39ca17a86ecca447cf30c8",
},
"RestApiId": {
"Ref": "Apiapi93AB445C",
@@ -1170,7 +1170,7 @@ exports[`api with 'name' parameter 1`] = `
},
},
},
- "/{proxy+}": {
+ "/{name}/{proxy+}": {
"x-amazon-apigateway-any-method": {
"produces": [
"application/json",
@@ -1271,7 +1271,7 @@ exports[`api with 'name' parameter 1`] = `
"Type": "AWS::IAM::Role",
"UpdateReplacePolicy": "Retain",
},
- "Apiapideployment63AA90062896733bcfed3fd7fed219dcae5c3b08": {
+ "Apiapideployment63AA9006e77e5fce96817943615e86914e22fe63": {
"DeletionPolicy": "Retain",
"Properties": {
"RestApiId": {
@@ -1321,7 +1321,7 @@ exports[`api with 'name' parameter 1`] = `
],
"Properties": {
"DeploymentId": {
- "Ref": "Apiapideployment63AA90062896733bcfed3fd7fed219dcae5c3b08",
+ "Ref": "Apiapideployment63AA9006e77e5fce96817943615e86914e22fe63",
},
"RestApiId": {
"Ref": "Apiapi93AB445C",
diff --git a/libs/wingsdk/src/cloud/api.ts b/libs/wingsdk/src/cloud/api.ts
index d2e01b35dfd..44ef54dfd73 100644
--- a/libs/wingsdk/src/cloud/api.ts
+++ b/libs/wingsdk/src/cloud/api.ts
@@ -409,9 +409,7 @@ export class Api extends Resource {
*/
protected _validatePath(path: string) {
if (
- !/^(\/[a-zA-Z0-9_\-\.]+(\/\:[a-zA-Z0-9_\-]+|\/[a-zA-Z0-9_\-\.]+)*(?:\?[^#]*)?)?$|^(\/\:[a-zA-Z0-9_\-]+)*\/?$/g.test(
- path
- )
+ !/^((\/\:[a-zA-Z0-9_\-]+|\/[a-zA-Z0-9_\-\.]*)*(?:\?[^#]*)?)?$/g.test(path)
) {
throw new Error(
`Invalid path ${path}. Url parts can only contain alpha-numeric chars, "-", "_" and ".". Params can only contain alpha-numeric chars and "_".`
@@ -432,6 +430,42 @@ export class Api extends Resource {
};
}
+ /**
+ * Checks if two given paths are siblings.
+ * @param pathA
+ * @param pathB
+ * @returns A boolean value indicating if provided paths are siblings.
+ * @internal
+ */
+
+ protected _arePathsSiblings(pathA: string, pathB: string): boolean {
+ const partsA = pathA.split("/");
+ const partsB = pathB.split("/");
+
+ let shorter = partsA.length < partsB.length ? partsA : partsB;
+
+ for (let i = 0; i < shorter.length; i++) {
+ const partA = partsA[i];
+ const partB = partsB[i];
+ if (
+ (!partA.match(/^:.+?$/) || !partB.match(/^:.+?$/)) &&
+ partA[i] !== partB[i]
+ ) {
+ return false;
+ }
+
+ if (
+ partA.match(/^:.+?$/) &&
+ partB.match(/^:.+?$/) &&
+ partA[i] !== partB[i]
+ ) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
/**
* Checks if two given paths are ambiguous.
* @param pathA
@@ -479,6 +513,20 @@ export class Api extends Resource {
);
}
+ /**
+ * Checks if provided path is a sibling of paths already defined in the api spec- i.e "/:username" and "/:id".
+ * @param path Path to be checked
+ * @returns A boolean value indicating if provided path has a sibling.
+ * @internal
+ */
+ private _findSiblingPath(path: string): string | undefined {
+ const existingPaths = Object.keys(this.apiSpec.paths);
+
+ return existingPaths.find((existingPath) =>
+ this._arePathsSiblings(existingPath, path)
+ );
+ }
+
/**
* Generates the OpenAPI schema for CORS headers based on the provided CORS options.
* @param corsOptions The CORS options to generate the schema from.
@@ -525,6 +573,12 @@ export class Api extends Resource {
`Endpoint for path '${path}' and method '${method}' is ambiguous - it conflicts with existing endpoint for path '${ambiguousPath}'`
);
}
+ const siblingPath = this._findSiblingPath(path);
+ if (!!siblingPath) {
+ throw new Error(
+ `Endpoint for path '${path}' and method '${method}' conflicts with existing sibling endpoint for path '${siblingPath}'- try to match the parameter names to avoid this error.`
+ );
+ }
const operationId = `${method.toLowerCase()}${
path === "/" ? "" : path.replace("/", "-")
}`;
diff --git a/libs/wingsdk/src/shared-aws/api.default.ts b/libs/wingsdk/src/shared-aws/api.default.ts
index 54e2631c7eb..7fb665057e2 100644
--- a/libs/wingsdk/src/shared-aws/api.default.ts
+++ b/libs/wingsdk/src/shared-aws/api.default.ts
@@ -1,17 +1,30 @@
import * as cloud from "../cloud";
/**
- * `API_DEFAULT_RESPONSE` is a constant that defines the default response when a request occurs.
+ * `createApiDefaultResponse` is a function that defines the default response when a request occurs.
* It is used to handle all requests that do not match any defined routes in the API Gateway.
* The response is a mock integration type, which means it returns a mocked response without
* forwarding the request to any backend. The response status code is set to 204 for OPTIONS
* and 404 for any other HTTP method. The Content-Type header is set to `application/json`.
+ * @param paths The user defined api endpoint paths. Used for creating a base path to the default response
+ * @param corsOptions cors options to apply to the default path
* @internal
*/
-export const API_DEFAULT_RESPONSE = (corsOptions?: cloud.ApiCorsOptions) => {
+export const createApiDefaultResponse = (
+ paths: string[],
+ corsOptions?: cloud.ApiCorsOptions
+) => {
+ const defaultKey =
+ // the longest a sequence of parameters starts form the root
+ paths.reduce((result: string, key: string) => {
+ // matches single sequence of parameters starts form the root
+ let matched = key.match(/^(\/{[A-Za-z0-9\-_]+})*/g)?.[0] ?? "";
+ return matched.length > result.length ? matched : result;
+ }, "") + "/{proxy+}";
+
if (corsOptions) {
return {
- "/{proxy+}": {
+ [defaultKey]: {
"x-amazon-apigateway-any-method": {
produces: ["application/json"],
"x-amazon-apigateway-integration": {
@@ -93,7 +106,7 @@ export const API_DEFAULT_RESPONSE = (corsOptions?: cloud.ApiCorsOptions) => {
};
} else {
return {
- "/{proxy+}": {
+ [defaultKey]: {
"x-amazon-apigateway-any-method": {
produces: ["application/json"],
"x-amazon-apigateway-integration": {
diff --git a/libs/wingsdk/src/target-tf-aws/api.ts b/libs/wingsdk/src/target-tf-aws/api.ts
index 2bdba489668..bdf0cd10f9e 100644
--- a/libs/wingsdk/src/target-tf-aws/api.ts
+++ b/libs/wingsdk/src/target-tf-aws/api.ts
@@ -19,7 +19,7 @@ import {
ResourceNames,
} from "../shared/resource-names";
import { ApiEndpointHandler, IAwsApi, STAGE_NAME } from "../shared-aws";
-import { API_DEFAULT_RESPONSE } from "../shared-aws/api.default";
+import { createApiDefaultResponse } from "../shared-aws/api.default";
import { IInflightHost, Node } from "../std";
/**
@@ -392,7 +392,6 @@ class WingRestApi extends Construct {
* - 404 (Not Found) for other HTTP methods.
* - If CORS options are undefined, `defaultResponse` set up a mock 404 response for any HTTP method.
*/
- const defaultResponse = API_DEFAULT_RESPONSE(props.cors);
/**
* BASIC API Gateway properties
@@ -406,6 +405,10 @@ class WingRestApi extends Construct {
produce: () => {
// Retrieves the API specification.
const apiSpec = props.getApiSpec();
+ const defaultResponse = createApiDefaultResponse(
+ Object.keys(apiSpec.paths),
+ props.cors
+ );
// Merges the specification with `defaultResponse` to handle requests to undefined routes (`/{proxy+}`).
// This integration ensures comprehensive route handling:
diff --git a/libs/wingsdk/test/target-sim/api.test.ts b/libs/wingsdk/test/target-sim/api.test.ts
index 0c845c404c2..128c674b144 100644
--- a/libs/wingsdk/test/target-sim/api.test.ts
+++ b/libs/wingsdk/test/target-sim/api.test.ts
@@ -1,5 +1,5 @@
import { createServer } from "net";
-import { test, expect } from "vitest";
+import { test, expect, describe } from "vitest";
import { listMessages } from "./util";
import * as cloud from "../../src/cloud";
import { inflight, lift } from "../../src/core";
@@ -787,3 +787,60 @@ test("api does not use a port that is already taken", async () => {
// clean up the server
server.close();
});
+
+describe("sibling paths are found", () => {
+ test("none parametrized paths are not siblings", () => {
+ const app = new SimApp();
+ const api = new cloud.Api(app, "my_api");
+
+ try {
+ api.get("/abc", INFLIGHT_CODE_NO_BODY);
+ api.get("/def", INFLIGHT_CODE_NO_BODY);
+ expect(true).toBeTruthy();
+ } catch (e) {
+ expect(false).toBeTruthy();
+ }
+ });
+ test("root parameterized paths are siblings", () => {
+ const app = new SimApp();
+ const api = new cloud.Api(app, "my_api");
+
+ try {
+ api.get("/:username/a", INFLIGHT_CODE_NO_BODY);
+ api.get("/:id/b", INFLIGHT_CODE_NO_BODY);
+ expect(false).toBeTruthy();
+ } catch (e) {
+ expect(e.message).toBe(
+ "Endpoint for path '/:id/b' and method 'GET' conflicts with existing sibling endpoint for path '/:username/a'- try to match the parameter names to avoid this error."
+ );
+ }
+ });
+
+ test("paths with different param name at the same index are siblings", () => {
+ const app = new SimApp();
+ const api = new cloud.Api(app, "my_api");
+
+ try {
+ api.get("/something/:username", INFLIGHT_CODE_NO_BODY);
+ api.get("/something_else/:id", INFLIGHT_CODE_NO_BODY);
+ expect(false).toBeTruthy();
+ } catch (e) {
+ expect(e.message).toBe(
+ "Endpoint for path '/something_else/:id' and method 'GET' conflicts with existing sibling endpoint for path '/something/:username'- try to match the parameter names to avoid this error."
+ );
+ }
+ });
+
+ test("paths with the same param name at the same index are siblings", () => {
+ const app = new SimApp();
+ const api = new cloud.Api(app, "my_api");
+
+ try {
+ api.get("/something/:username", INFLIGHT_CODE_NO_BODY);
+ api.get("/something_else/:username", INFLIGHT_CODE_NO_BODY);
+ expect(true).toBeTruthy();
+ } catch (e) {
+ expect(false).toBeTruthy();
+ }
+ });
+});
diff --git a/libs/wingsdk/test/target-tf-aws/__snapshots__/api.test.ts.snap b/libs/wingsdk/test/target-tf-aws/__snapshots__/api.test.ts.snap
index 94754fee643..bd2955e9683 100644
--- a/libs/wingsdk/test/target-tf-aws/__snapshots__/api.test.ts.snap
+++ b/libs/wingsdk/test/target-tf-aws/__snapshots__/api.test.ts.snap
@@ -415,7 +415,7 @@ exports[`api with 'name' & 'age' parameter 1`] = `
},
},
},
- "/{proxy+}": {
+ "/{name}/{age}/{proxy+}": {
"x-amazon-apigateway-any-method": {
"produces": [
"application/json",
@@ -502,7 +502,7 @@ exports[`api with 'name' parameter 1`] = `
},
},
},
- "/{proxy+}": {
+ "/{name}/{proxy+}": {
"x-amazon-apigateway-any-method": {
"produces": [
"application/json",
diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/post.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/post.test.w_compile_tf-aws.md
index 6fc35146227..ccfc1c80390 100644
--- a/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/post.test.w_compile_tf-aws.md
+++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/post.test.w_compile_tf-aws.md
@@ -81,7 +81,7 @@
"uniqueId": "Api_api_91C07D84"
}
},
- "body": "{\"paths\":{\"/path\":{\"post\":{\"operationId\":\"post-path\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:post_path0-c8a546a0/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}},\"openapi\":\"3.0.3\"}",
+ "body": "{\"paths\":{\"/\":{\"post\":{\"operationId\":\"post\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:post_0-c8d25f85/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}},\"openapi\":\"3.0.3\"}",
"lifecycle": {
"create_before_destroy": true
},
@@ -102,58 +102,58 @@
}
},
"aws_cloudwatch_log_group": {
- "Api_post_path0_CloudwatchLogGroup_D36E289E": {
+ "Api_post_0_CloudwatchLogGroup_2657635B": {
"//": {
"metadata": {
- "path": "root/Default/Default/Api/post_path0/CloudwatchLogGroup",
- "uniqueId": "Api_post_path0_CloudwatchLogGroup_D36E289E"
+ "path": "root/Default/Default/Api/post_0/CloudwatchLogGroup",
+ "uniqueId": "Api_post_0_CloudwatchLogGroup_2657635B"
}
},
- "name": "/aws/lambda/post_path0-c8a546a0",
+ "name": "/aws/lambda/post_0-c8d25f85",
"retention_in_days": 30
}
},
"aws_iam_role": {
- "Api_post_path0_IamRole_8E1F7602": {
+ "Api_post_0_IamRole_5AF65E98": {
"//": {
"metadata": {
- "path": "root/Default/Default/Api/post_path0/IamRole",
- "uniqueId": "Api_post_path0_IamRole_8E1F7602"
+ "path": "root/Default/Default/Api/post_0/IamRole",
+ "uniqueId": "Api_post_0_IamRole_5AF65E98"
}
},
"assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}"
}
},
"aws_iam_role_policy": {
- "Api_post_path0_IamRolePolicy_A6FF5A38": {
+ "Api_post_0_IamRolePolicy_DB973D78": {
"//": {
"metadata": {
- "path": "root/Default/Default/Api/post_path0/IamRolePolicy",
- "uniqueId": "Api_post_path0_IamRolePolicy_A6FF5A38"
+ "path": "root/Default/Default/Api/post_0/IamRolePolicy",
+ "uniqueId": "Api_post_0_IamRolePolicy_DB973D78"
}
},
"policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"none:null\",\"Resource\":\"*\"}]}",
- "role": "${aws_iam_role.Api_post_path0_IamRole_8E1F7602.name}"
+ "role": "${aws_iam_role.Api_post_0_IamRole_5AF65E98.name}"
}
},
"aws_iam_role_policy_attachment": {
- "Api_post_path0_IamRolePolicyAttachment_6C1025DF": {
+ "Api_post_0_IamRolePolicyAttachment_ABFC7DE6": {
"//": {
"metadata": {
- "path": "root/Default/Default/Api/post_path0/IamRolePolicyAttachment",
- "uniqueId": "Api_post_path0_IamRolePolicyAttachment_6C1025DF"
+ "path": "root/Default/Default/Api/post_0/IamRolePolicyAttachment",
+ "uniqueId": "Api_post_0_IamRolePolicyAttachment_ABFC7DE6"
}
},
"policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole",
- "role": "${aws_iam_role.Api_post_path0_IamRole_8E1F7602.name}"
+ "role": "${aws_iam_role.Api_post_0_IamRole_5AF65E98.name}"
}
},
"aws_lambda_function": {
- "Api_post_path0_688B6375": {
+ "Api_post_0_211FC41C": {
"//": {
"metadata": {
- "path": "root/Default/Default/Api/post_path0/Default",
- "uniqueId": "Api_post_path0_688B6375"
+ "path": "root/Default/Default/Api/post_0/Default",
+ "uniqueId": "Api_post_0_211FC41C"
}
},
"architectures": [
@@ -162,18 +162,18 @@
"environment": {
"variables": {
"NODE_OPTIONS": "--enable-source-maps",
- "WING_FUNCTION_NAME": "post_path0-c8a546a0",
+ "WING_FUNCTION_NAME": "post_0-c8d25f85",
"WING_TARGET": "tf-aws"
}
},
- "function_name": "post_path0-c8a546a0",
+ "function_name": "post_0-c8d25f85",
"handler": "index.handler",
"memory_size": 1024,
"publish": true,
- "role": "${aws_iam_role.Api_post_path0_IamRole_8E1F7602.arn}",
+ "role": "${aws_iam_role.Api_post_0_IamRole_5AF65E98.arn}",
"runtime": "nodejs20.x",
"s3_bucket": "${aws_s3_bucket.Code.bucket}",
- "s3_key": "${aws_s3_object.Api_post_path0_S3Object_BDECB8C0.key}",
+ "s3_key": "${aws_s3_object.Api_post_0_S3Object_F8F9D391.key}",
"timeout": 60,
"vpc_config": {
"security_group_ids": [],
@@ -182,18 +182,18 @@
}
},
"aws_lambda_permission": {
- "Api_api_permission-POST-e2131352_83D11BF7": {
+ "Api_api_permission-POST-c2e3ffa8_4BF1BB79": {
"//": {
"metadata": {
- "path": "root/Default/Default/Api/api/permission-POST-e2131352",
- "uniqueId": "Api_api_permission-POST-e2131352_83D11BF7"
+ "path": "root/Default/Default/Api/api/permission-POST-c2e3ffa8",
+ "uniqueId": "Api_api_permission-POST-c2e3ffa8_4BF1BB79"
}
},
"action": "lambda:InvokeFunction",
- "function_name": "${aws_lambda_function.Api_post_path0_688B6375.function_name}",
+ "function_name": "${aws_lambda_function.Api_post_0_211FC41C.function_name}",
"principal": "apigateway.amazonaws.com",
- "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/POST/path",
- "statement_id": "AllowExecutionFromAPIGateway-POST-e2131352"
+ "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/POST/",
+ "statement_id": "AllowExecutionFromAPIGateway-POST-c2e3ffa8"
}
},
"aws_s3_bucket": {
@@ -208,11 +208,11 @@
}
},
"aws_s3_object": {
- "Api_post_path0_S3Object_BDECB8C0": {
+ "Api_post_0_S3Object_F8F9D391": {
"//": {
"metadata": {
- "path": "root/Default/Default/Api/post_path0/S3Object",
- "uniqueId": "Api_post_path0_S3Object_BDECB8C0"
+ "path": "root/Default/Default/Api/post_0/S3Object",
+ "uniqueId": "Api_post_0_S3Object_F8F9D391"
}
},
"bucket": "${aws_s3_bucket.Code.bucket}",
diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/root_path_vars.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/root_path_vars.test.w_compile_tf-aws.md
new file mode 100644
index 00000000000..a8795f148a8
--- /dev/null
+++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/root_path_vars.test.w_compile_tf-aws.md
@@ -0,0 +1,265 @@
+# [root_path_vars.test.w](../../../../../../examples/tests/sdk_tests/api/root_path_vars.test.w) | compile | tf-aws
+
+## main.tf.json
+```json
+{
+ "//": {
+ "metadata": {
+ "backend": "local",
+ "stackName": "root",
+ "version": "0.20.3"
+ },
+ "outputs": {
+ "root": {
+ "Default": {
+ "Default": {
+ "Api": {
+ "Endpoint": {
+ "Url": "Api_Endpoint_Url_473FEE9F"
+ }
+ }
+ }
+ }
+ }
+ }
+ },
+ "data": {
+ "aws_caller_identity": {
+ "account": {
+ "//": {
+ "metadata": {
+ "path": "root/Default/account",
+ "uniqueId": "account"
+ }
+ }
+ }
+ },
+ "aws_region": {
+ "Region": {
+ "//": {
+ "metadata": {
+ "path": "root/Default/Region",
+ "uniqueId": "Region"
+ }
+ }
+ }
+ }
+ },
+ "output": {
+ "Api_Endpoint_Url_473FEE9F": {
+ "value": "https://${aws_api_gateway_rest_api.Api_api_91C07D84.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.Api_api_stage_E0FA39D6.stage_name}"
+ }
+ },
+ "provider": {
+ "aws": [
+ {}
+ ]
+ },
+ "resource": {
+ "aws_api_gateway_deployment": {
+ "Api_api_deployment_7FB64CC4": {
+ "//": {
+ "metadata": {
+ "path": "root/Default/Default/Api/api/deployment",
+ "uniqueId": "Api_api_deployment_7FB64CC4"
+ }
+ },
+ "lifecycle": {
+ "create_before_destroy": true
+ },
+ "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}",
+ "triggers": {
+ "redeployment": "${sha256(aws_api_gateway_rest_api.Api_api_91C07D84.body)}"
+ }
+ }
+ },
+ "aws_api_gateway_rest_api": {
+ "Api_api_91C07D84": {
+ "//": {
+ "metadata": {
+ "path": "root/Default/Default/Api/api/api",
+ "uniqueId": "Api_api_91C07D84"
+ }
+ },
+ "body": "{\"paths\":{\"/{id}\":{\"get\":{\"operationId\":\"get-:id\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[{\"name\":\"id\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_-id0-c8c761b0/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{id}/comments\":{\"get\":{\"operationId\":\"get-:id/comments\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[{\"name\":\"id\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_-id0-c8c761b0/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{id}/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}},\"openapi\":\"3.0.3\"}",
+ "lifecycle": {
+ "create_before_destroy": true
+ },
+ "name": "api-c8f613f0"
+ }
+ },
+ "aws_api_gateway_stage": {
+ "Api_api_stage_E0FA39D6": {
+ "//": {
+ "metadata": {
+ "path": "root/Default/Default/Api/api/stage",
+ "uniqueId": "Api_api_stage_E0FA39D6"
+ }
+ },
+ "deployment_id": "${aws_api_gateway_deployment.Api_api_deployment_7FB64CC4.id}",
+ "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}",
+ "stage_name": "prod"
+ }
+ },
+ "aws_cloudwatch_log_group": {
+ "Api_get_id0_CloudwatchLogGroup_3D15D155": {
+ "//": {
+ "metadata": {
+ "path": "root/Default/Default/Api/get_:id0/CloudwatchLogGroup",
+ "uniqueId": "Api_get_id0_CloudwatchLogGroup_3D15D155"
+ }
+ },
+ "name": "/aws/lambda/get_-id0-c8c761b0",
+ "retention_in_days": 30
+ }
+ },
+ "aws_iam_role": {
+ "Api_get_id0_IamRole_74C8077C": {
+ "//": {
+ "metadata": {
+ "path": "root/Default/Default/Api/get_:id0/IamRole",
+ "uniqueId": "Api_get_id0_IamRole_74C8077C"
+ }
+ },
+ "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}"
+ }
+ },
+ "aws_iam_role_policy": {
+ "Api_get_id0_IamRolePolicy_7D71CFCB": {
+ "//": {
+ "metadata": {
+ "path": "root/Default/Default/Api/get_:id0/IamRolePolicy",
+ "uniqueId": "Api_get_id0_IamRolePolicy_7D71CFCB"
+ }
+ },
+ "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"none:null\",\"Resource\":\"*\"}]}",
+ "role": "${aws_iam_role.Api_get_id0_IamRole_74C8077C.name}"
+ }
+ },
+ "aws_iam_role_policy_attachment": {
+ "Api_get_id0_IamRolePolicyAttachment_7C1C1CAD": {
+ "//": {
+ "metadata": {
+ "path": "root/Default/Default/Api/get_:id0/IamRolePolicyAttachment",
+ "uniqueId": "Api_get_id0_IamRolePolicyAttachment_7C1C1CAD"
+ }
+ },
+ "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole",
+ "role": "${aws_iam_role.Api_get_id0_IamRole_74C8077C.name}"
+ }
+ },
+ "aws_lambda_function": {
+ "Api_get_id0_A3510FB1": {
+ "//": {
+ "metadata": {
+ "path": "root/Default/Default/Api/get_:id0/Default",
+ "uniqueId": "Api_get_id0_A3510FB1"
+ }
+ },
+ "architectures": [
+ "arm64"
+ ],
+ "environment": {
+ "variables": {
+ "NODE_OPTIONS": "--enable-source-maps",
+ "WING_FUNCTION_NAME": "get_-id0-c8c761b0",
+ "WING_TARGET": "tf-aws"
+ }
+ },
+ "function_name": "get_-id0-c8c761b0",
+ "handler": "index.handler",
+ "memory_size": 1024,
+ "publish": true,
+ "role": "${aws_iam_role.Api_get_id0_IamRole_74C8077C.arn}",
+ "runtime": "nodejs20.x",
+ "s3_bucket": "${aws_s3_bucket.Code.bucket}",
+ "s3_key": "${aws_s3_object.Api_get_id0_S3Object_D25336B5.key}",
+ "timeout": 60,
+ "vpc_config": {
+ "security_group_ids": [],
+ "subnet_ids": []
+ }
+ }
+ },
+ "aws_lambda_permission": {
+ "Api_api_permission-GET-86d7f190_3EAF9825": {
+ "//": {
+ "metadata": {
+ "path": "root/Default/Default/Api/api/permission-GET-86d7f190",
+ "uniqueId": "Api_api_permission-GET-86d7f190_3EAF9825"
+ }
+ },
+ "action": "lambda:InvokeFunction",
+ "function_name": "${aws_lambda_function.Api_get_id0_A3510FB1.function_name}",
+ "principal": "apigateway.amazonaws.com",
+ "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/{id}",
+ "statement_id": "AllowExecutionFromAPIGateway-GET-86d7f190"
+ },
+ "Api_api_permission-GET-8d0f082e_AD9E18AF": {
+ "//": {
+ "metadata": {
+ "path": "root/Default/Default/Api/api/permission-GET-8d0f082e",
+ "uniqueId": "Api_api_permission-GET-8d0f082e_AD9E18AF"
+ }
+ },
+ "action": "lambda:InvokeFunction",
+ "function_name": "${aws_lambda_function.Api_get_id0_A3510FB1.function_name}",
+ "principal": "apigateway.amazonaws.com",
+ "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/{id}/comments",
+ "statement_id": "AllowExecutionFromAPIGateway-GET-8d0f082e"
+ },
+ "Api_api_permission-GET-f57faab6_11BF5CEE": {
+ "//": {
+ "metadata": {
+ "path": "root/Default/Default/Api/api/permission-GET-f57faab6",
+ "uniqueId": "Api_api_permission-GET-f57faab6_11BF5CEE"
+ }
+ },
+ "action": "lambda:InvokeFunction",
+ "function_name": "${aws_lambda_function.Api_get_id0_A3510FB1.function_name}",
+ "principal": "apigateway.amazonaws.com",
+ "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/{username}/something",
+ "statement_id": "AllowExecutionFromAPIGateway-GET-f57faab6"
+ },
+ "Api_api_permission-POST-88b37de1_E0D219BB": {
+ "//": {
+ "metadata": {
+ "path": "root/Default/Default/Api/api/permission-POST-88b37de1",
+ "uniqueId": "Api_api_permission-POST-88b37de1_E0D219BB"
+ }
+ },
+ "action": "lambda:InvokeFunction",
+ "function_name": "${aws_lambda_function.Api_get_id0_A3510FB1.function_name}",
+ "principal": "apigateway.amazonaws.com",
+ "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/POST/{username}",
+ "statement_id": "AllowExecutionFromAPIGateway-POST-88b37de1"
+ }
+ },
+ "aws_s3_bucket": {
+ "Code": {
+ "//": {
+ "metadata": {
+ "path": "root/Default/Code",
+ "uniqueId": "Code"
+ }
+ },
+ "bucket_prefix": "code-c84a50b1-"
+ }
+ },
+ "aws_s3_object": {
+ "Api_get_id0_S3Object_D25336B5": {
+ "//": {
+ "metadata": {
+ "path": "root/Default/Default/Api/get_:id0/S3Object",
+ "uniqueId": "Api_get_id0_S3Object_D25336B5"
+ }
+ },
+ "bucket": "${aws_s3_bucket.Code.bucket}",
+ "key": "",
+ "source": ""
+ }
+ }
+ }
+}
+```
+
diff --git a/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/root_path_vars.test.w_test_sim.md b/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/root_path_vars.test.w_test_sim.md
new file mode 100644
index 00000000000..b1bac5650db
--- /dev/null
+++ b/tools/hangar/__snapshots__/test_corpus/sdk_tests/api/root_path_vars.test.w_test_sim.md
@@ -0,0 +1,12 @@
+# [root_path_vars.test.w](../../../../../../examples/tests/sdk_tests/api/root_path_vars.test.w) | test | sim
+
+## stdout.log
+```log
+pass ─ root_path_vars.test.wsim » root/env0/test:path vars at endpoint root are working as expected
+
+Tests 1 passed (1)
+Snapshots 1 skipped
+Test Files 1 passed (1)
+Duration
+```
+
diff --git a/tools/hangar/__snapshots__/test_corpus/valid/api_valid_path.test.w_compile_tf-aws.md b/tools/hangar/__snapshots__/test_corpus/valid/api_valid_path.test.w_compile_tf-aws.md
index 4eaa4b959e1..712527ac8e7 100644
--- a/tools/hangar/__snapshots__/test_corpus/valid/api_valid_path.test.w_compile_tf-aws.md
+++ b/tools/hangar/__snapshots__/test_corpus/valid/api_valid_path.test.w_compile_tf-aws.md
@@ -33,9 +33,14 @@ module.exports = function({ }) {
"root": {
"Default": {
"Default": {
- "Api": {
+ "api for root path": {
"Endpoint": {
- "Url": "Api_Endpoint_Url_473FEE9F"
+ "Url": "apiforrootpath_Endpoint_Url_A5988D30"
+ }
+ },
+ "default api": {
+ "Endpoint": {
+ "Url": "defaultapi_Endpoint_Url_20F55364"
}
}
}
@@ -66,8 +71,11 @@ module.exports = function({ }) {
}
},
"output": {
- "Api_Endpoint_Url_473FEE9F": {
- "value": "https://${aws_api_gateway_rest_api.Api_api_91C07D84.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.Api_api_stage_E0FA39D6.stage_name}"
+ "apiforrootpath_Endpoint_Url_A5988D30": {
+ "value": "https://${aws_api_gateway_rest_api.apiforrootpath_api_53DF977A.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.apiforrootpath_api_stage_C60BBF0F.stage_name}"
+ },
+ "defaultapi_Endpoint_Url_20F55364": {
+ "value": "https://${aws_api_gateway_rest_api.defaultapi_D23C5D48.id}.execute-api.${data.aws_region.Region.name}.amazonaws.com/${aws_api_gateway_stage.defaultapi_stage_839E3FD0.stage_name}"
}
},
"provider": {
@@ -77,103 +85,181 @@ module.exports = function({ }) {
},
"resource": {
"aws_api_gateway_deployment": {
- "Api_api_deployment_7FB64CC4": {
+ "apiforrootpath_api_deployment_A1552CE9": {
"//": {
"metadata": {
- "path": "root/Default/Default/Api/api/deployment",
- "uniqueId": "Api_api_deployment_7FB64CC4"
+ "path": "root/Default/Default/api for root path/api/deployment",
+ "uniqueId": "apiforrootpath_api_deployment_A1552CE9"
}
},
"lifecycle": {
"create_before_destroy": true
},
- "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}",
+ "rest_api_id": "${aws_api_gateway_rest_api.apiforrootpath_api_53DF977A.id}",
"triggers": {
- "redeployment": "${sha256(aws_api_gateway_rest_api.Api_api_91C07D84.body)}"
+ "redeployment": "${sha256(aws_api_gateway_rest_api.apiforrootpath_api_53DF977A.body)}"
+ }
+ },
+ "defaultapi_deployment_2421A004": {
+ "//": {
+ "metadata": {
+ "path": "root/Default/Default/default api/api/deployment",
+ "uniqueId": "defaultapi_deployment_2421A004"
+ }
+ },
+ "lifecycle": {
+ "create_before_destroy": true
+ },
+ "rest_api_id": "${aws_api_gateway_rest_api.defaultapi_D23C5D48.id}",
+ "triggers": {
+ "redeployment": "${sha256(aws_api_gateway_rest_api.defaultapi_D23C5D48.body)}"
}
}
},
"aws_api_gateway_rest_api": {
- "Api_api_91C07D84": {
+ "apiforrootpath_api_53DF977A": {
"//": {
"metadata": {
- "path": "root/Default/Default/Api/api/api",
- "uniqueId": "Api_api_91C07D84"
+ "path": "root/Default/Default/api for root path/api/api",
+ "uniqueId": "apiforrootpath_api_53DF977A"
}
},
- "body": "{\"paths\":{\"/test/path\":{\"get\":{\"operationId\":\"get-test/path\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8bdb226/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/test/alphanumer1cPa_th\":{\"get\":{\"operationId\":\"get-test/alphanumer1cPa_th\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8bdb226/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/test/regular/path\":{\"get\":{\"operationId\":\"get-test/regular/path\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8bdb226/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/test/pa-th/{with}/two/{variable_s}/f?bla=5&b=6\":{\"get\":{\"operationId\":\"get-test/pa-th/:with/two/:variable_s/f?bla=5&b=6\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[{\"name\":\"with\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}},{\"name\":\"variable_s\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8bdb226/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/test/param/is/{last}\":{\"get\":{\"operationId\":\"get-test/param/is/:last\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[{\"name\":\"last\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8bdb226/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/test/path/{param}\":{\"get\":{\"operationId\":\"get-test/path/:param\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[{\"name\":\"param\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8bdb226/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{param}\":{\"get\":{\"operationId\":\"get-:param\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[{\"name\":\"param\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8bdb226/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/t/{param}\":{\"get\":{\"operationId\":\"get-t/:param\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[{\"name\":\"param\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8bdb226/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/test/regular/path/{param}\":{\"get\":{\"operationId\":\"get-test/regular/path/:param\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[{\"name\":\"param\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8bdb226/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/test/segment1/{param1}/segment2?query1=value1?query2=value2\":{\"get\":{\"operationId\":\"get-test/segment1/:param1/segment2?query1=value1?query2=value2\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[{\"name\":\"param1\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8bdb226/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/test/segment1/segment2?query=value1&query2=value2\":{\"get\":{\"operationId\":\"get-test/segment1/segment2?query=value1&query2=value2\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8bdb226/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/test/path.withDots\":{\"get\":{\"operationId\":\"get-test/path.withDots\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8bdb226/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/test/path/.withDots/{param}/{param-dash}/x\":{\"get\":{\"operationId\":\"get-test/path/.withDots/:param/:param-dash/x\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[{\"name\":\"param\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}},{\"name\":\"param-dash\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8bdb226/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}},\"openapi\":\"3.0.3\"}",
+ "body": "{\"paths\":{\"/\":{\"get\":{\"operationId\":\"get\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_0-c856f001/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}},\"openapi\":\"3.0.3\"}",
"lifecycle": {
"create_before_destroy": true
},
- "name": "api-c8f613f0"
+ "name": "api-c8d24ab6"
+ },
+ "defaultapi_D23C5D48": {
+ "//": {
+ "metadata": {
+ "path": "root/Default/Default/default api/api/api",
+ "uniqueId": "defaultapi_D23C5D48"
+ }
+ },
+ "body": "{\"paths\":{\"/test/path\":{\"get\":{\"operationId\":\"get-test/path\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8261424/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/test/alphanumer1cPa_th\":{\"get\":{\"operationId\":\"get-test/alphanumer1cPa_th\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8261424/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/test/regular/path\":{\"get\":{\"operationId\":\"get-test/regular/path\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8261424/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/test/pa-th/{with}/two/{variable_s}/f?bla=5&b=6\":{\"get\":{\"operationId\":\"get-test/pa-th/:with/two/:variable_s/f?bla=5&b=6\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[{\"name\":\"with\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}},{\"name\":\"variable_s\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8261424/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/test/param/is/{last}\":{\"get\":{\"operationId\":\"get-test/param/is/:last\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[{\"name\":\"last\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8261424/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/test/path/{param}\":{\"get\":{\"operationId\":\"get-test/path/:param\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[{\"name\":\"param\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8261424/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{param}\":{\"get\":{\"operationId\":\"get-:param\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[{\"name\":\"param\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8261424/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/t/{param}\":{\"get\":{\"operationId\":\"get-t/:param\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[{\"name\":\"param\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8261424/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/test/regular/path/{param}\":{\"get\":{\"operationId\":\"get-test/regular/path/:param\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[{\"name\":\"param\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8261424/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/test/segment1/{param1}/segment2?query1=value1?query2=value2\":{\"get\":{\"operationId\":\"get-test/segment1/:param1/segment2?query1=value1?query2=value2\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[{\"name\":\"param1\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8261424/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/test/segment1/segment2?query=value1&query2=value2\":{\"get\":{\"operationId\":\"get-test/segment1/segment2?query=value1&query2=value2\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8261424/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/test/path.withDots\":{\"get\":{\"operationId\":\"get-test/path.withDots\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8261424/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/test/path/.withDots/{param}/{param-dash}/x\":{\"get\":{\"operationId\":\"get-test/path/.withDots/:param/:param-dash/x\",\"responses\":{\"200\":{\"description\":\"200 response\",\"content\":{}}},\"parameters\":[{\"name\":\"param\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}},{\"name\":\"param-dash\",\"in\":\"path\",\"required\":true,\"schema\":{\"type\":\"string\"}}],\"x-amazon-apigateway-integration\":{\"uri\":\"arn:aws:apigateway:${data.aws_region.Region.name}:lambda:path/2015-03-31/functions/arn:aws:lambda:${data.aws_region.Region.name}:${data.aws_caller_identity.account.account_id}:function:get_test_path0-c8261424/invocations\",\"type\":\"aws_proxy\",\"httpMethod\":\"POST\",\"responses\":{\"default\":{\"statusCode\":\"200\"}},\"passthroughBehavior\":\"when_no_match\",\"contentHandling\":\"CONVERT_TO_TEXT\"}}},\"/{param}/{proxy+}\":{\"x-amazon-apigateway-any-method\":{\"produces\":[\"application/json\"],\"x-amazon-apigateway-integration\":{\"type\":\"mock\",\"requestTemplates\":{\"application/json\":\"\\n {\\\"statusCode\\\": 404}\\n \"},\"passthroughBehavior\":\"never\",\"responses\":{\"404\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}},\"default\":{\"statusCode\":\"404\",\"responseParameters\":{\"method.response.header.Content-Type\":\"'application/json'\"},\"responseTemplates\":{\"application/json\":\"{\\\"statusCode\\\": 404, \\\"message\\\": \\\"Error: Resource not found\\\"}\"}}}},\"responses\":{\"404\":{\"description\":\"404 response\",\"headers\":{\"Content-Type\":{\"type\":\"string\"}}}}}}},\"openapi\":\"3.0.3\"}",
+ "lifecycle": {
+ "create_before_destroy": true
+ },
+ "name": "api-c80ca82f"
}
},
"aws_api_gateway_stage": {
- "Api_api_stage_E0FA39D6": {
+ "apiforrootpath_api_stage_C60BBF0F": {
"//": {
"metadata": {
- "path": "root/Default/Default/Api/api/stage",
- "uniqueId": "Api_api_stage_E0FA39D6"
+ "path": "root/Default/Default/api for root path/api/stage",
+ "uniqueId": "apiforrootpath_api_stage_C60BBF0F"
}
},
- "deployment_id": "${aws_api_gateway_deployment.Api_api_deployment_7FB64CC4.id}",
- "rest_api_id": "${aws_api_gateway_rest_api.Api_api_91C07D84.id}",
+ "deployment_id": "${aws_api_gateway_deployment.apiforrootpath_api_deployment_A1552CE9.id}",
+ "rest_api_id": "${aws_api_gateway_rest_api.apiforrootpath_api_53DF977A.id}",
+ "stage_name": "prod"
+ },
+ "defaultapi_stage_839E3FD0": {
+ "//": {
+ "metadata": {
+ "path": "root/Default/Default/default api/api/stage",
+ "uniqueId": "defaultapi_stage_839E3FD0"
+ }
+ },
+ "deployment_id": "${aws_api_gateway_deployment.defaultapi_deployment_2421A004.id}",
+ "rest_api_id": "${aws_api_gateway_rest_api.defaultapi_D23C5D48.id}",
"stage_name": "prod"
}
},
"aws_cloudwatch_log_group": {
- "Api_get_test_path0_CloudwatchLogGroup_409E5E8A": {
+ "apiforrootpath_get_0_CloudwatchLogGroup_13F2460E": {
"//": {
"metadata": {
- "path": "root/Default/Default/Api/get_test_path0/CloudwatchLogGroup",
- "uniqueId": "Api_get_test_path0_CloudwatchLogGroup_409E5E8A"
+ "path": "root/Default/Default/api for root path/get_0/CloudwatchLogGroup",
+ "uniqueId": "apiforrootpath_get_0_CloudwatchLogGroup_13F2460E"
}
},
- "name": "/aws/lambda/get_test_path0-c8bdb226",
+ "name": "/aws/lambda/get_0-c856f001",
+ "retention_in_days": 30
+ },
+ "defaultapi_get_test_path0_CloudwatchLogGroup_671C6A53": {
+ "//": {
+ "metadata": {
+ "path": "root/Default/Default/default api/get_test_path0/CloudwatchLogGroup",
+ "uniqueId": "defaultapi_get_test_path0_CloudwatchLogGroup_671C6A53"
+ }
+ },
+ "name": "/aws/lambda/get_test_path0-c8261424",
"retention_in_days": 30
}
},
"aws_iam_role": {
- "Api_get_test_path0_IamRole_C41D1174": {
+ "apiforrootpath_get_0_IamRole_D4539E0B": {
+ "//": {
+ "metadata": {
+ "path": "root/Default/Default/api for root path/get_0/IamRole",
+ "uniqueId": "apiforrootpath_get_0_IamRole_D4539E0B"
+ }
+ },
+ "assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}"
+ },
+ "defaultapi_get_test_path0_IamRole_6EABF872": {
"//": {
"metadata": {
- "path": "root/Default/Default/Api/get_test_path0/IamRole",
- "uniqueId": "Api_get_test_path0_IamRole_C41D1174"
+ "path": "root/Default/Default/default api/get_test_path0/IamRole",
+ "uniqueId": "defaultapi_get_test_path0_IamRole_6EABF872"
}
},
"assume_role_policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Action\":\"sts:AssumeRole\",\"Principal\":{\"Service\":\"lambda.amazonaws.com\"},\"Effect\":\"Allow\"}]}"
}
},
"aws_iam_role_policy": {
- "Api_get_test_path0_IamRolePolicy_871429E4": {
+ "apiforrootpath_get_0_IamRolePolicy_505D6447": {
+ "//": {
+ "metadata": {
+ "path": "root/Default/Default/api for root path/get_0/IamRolePolicy",
+ "uniqueId": "apiforrootpath_get_0_IamRolePolicy_505D6447"
+ }
+ },
+ "policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"none:null\",\"Resource\":\"*\"}]}",
+ "role": "${aws_iam_role.apiforrootpath_get_0_IamRole_D4539E0B.name}"
+ },
+ "defaultapi_get_test_path0_IamRolePolicy_56E9A36F": {
"//": {
"metadata": {
- "path": "root/Default/Default/Api/get_test_path0/IamRolePolicy",
- "uniqueId": "Api_get_test_path0_IamRolePolicy_871429E4"
+ "path": "root/Default/Default/default api/get_test_path0/IamRolePolicy",
+ "uniqueId": "defaultapi_get_test_path0_IamRolePolicy_56E9A36F"
}
},
"policy": "{\"Version\":\"2012-10-17\",\"Statement\":[{\"Effect\":\"Allow\",\"Action\":\"none:null\",\"Resource\":\"*\"}]}",
- "role": "${aws_iam_role.Api_get_test_path0_IamRole_C41D1174.name}"
+ "role": "${aws_iam_role.defaultapi_get_test_path0_IamRole_6EABF872.name}"
}
},
"aws_iam_role_policy_attachment": {
- "Api_get_test_path0_IamRolePolicyAttachment_E6813A4F": {
+ "apiforrootpath_get_0_IamRolePolicyAttachment_B829E8A4": {
"//": {
"metadata": {
- "path": "root/Default/Default/Api/get_test_path0/IamRolePolicyAttachment",
- "uniqueId": "Api_get_test_path0_IamRolePolicyAttachment_E6813A4F"
+ "path": "root/Default/Default/api for root path/get_0/IamRolePolicyAttachment",
+ "uniqueId": "apiforrootpath_get_0_IamRolePolicyAttachment_B829E8A4"
}
},
"policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole",
- "role": "${aws_iam_role.Api_get_test_path0_IamRole_C41D1174.name}"
+ "role": "${aws_iam_role.apiforrootpath_get_0_IamRole_D4539E0B.name}"
+ },
+ "defaultapi_get_test_path0_IamRolePolicyAttachment_CB835A8E": {
+ "//": {
+ "metadata": {
+ "path": "root/Default/Default/default api/get_test_path0/IamRolePolicyAttachment",
+ "uniqueId": "defaultapi_get_test_path0_IamRolePolicyAttachment_CB835A8E"
+ }
+ },
+ "policy_arn": "arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole",
+ "role": "${aws_iam_role.defaultapi_get_test_path0_IamRole_6EABF872.name}"
}
},
"aws_lambda_function": {
- "Api_get_test_path0_645426B9": {
+ "apiforrootpath_get_0_057FC713": {
"//": {
"metadata": {
- "path": "root/Default/Default/Api/get_test_path0/Default",
- "uniqueId": "Api_get_test_path0_645426B9"
+ "path": "root/Default/Default/api for root path/get_0/Default",
+ "uniqueId": "apiforrootpath_get_0_057FC713"
}
},
"architectures": [
@@ -182,18 +268,49 @@ module.exports = function({ }) {
"environment": {
"variables": {
"NODE_OPTIONS": "--enable-source-maps",
- "WING_FUNCTION_NAME": "get_test_path0-c8bdb226",
+ "WING_FUNCTION_NAME": "get_0-c856f001",
"WING_TARGET": "tf-aws"
}
},
- "function_name": "get_test_path0-c8bdb226",
+ "function_name": "get_0-c856f001",
"handler": "index.handler",
"memory_size": 1024,
"publish": true,
- "role": "${aws_iam_role.Api_get_test_path0_IamRole_C41D1174.arn}",
+ "role": "${aws_iam_role.apiforrootpath_get_0_IamRole_D4539E0B.arn}",
"runtime": "nodejs20.x",
"s3_bucket": "${aws_s3_bucket.Code.bucket}",
- "s3_key": "${aws_s3_object.Api_get_test_path0_S3Object_F8C2A41F.key}",
+ "s3_key": "${aws_s3_object.apiforrootpath_get_0_S3Object_426DA1A7.key}",
+ "timeout": 60,
+ "vpc_config": {
+ "security_group_ids": [],
+ "subnet_ids": []
+ }
+ },
+ "defaultapi_get_test_path0_B7A07AB2": {
+ "//": {
+ "metadata": {
+ "path": "root/Default/Default/default api/get_test_path0/Default",
+ "uniqueId": "defaultapi_get_test_path0_B7A07AB2"
+ }
+ },
+ "architectures": [
+ "arm64"
+ ],
+ "environment": {
+ "variables": {
+ "NODE_OPTIONS": "--enable-source-maps",
+ "WING_FUNCTION_NAME": "get_test_path0-c8261424",
+ "WING_TARGET": "tf-aws"
+ }
+ },
+ "function_name": "get_test_path0-c8261424",
+ "handler": "index.handler",
+ "memory_size": 1024,
+ "publish": true,
+ "role": "${aws_iam_role.defaultapi_get_test_path0_IamRole_6EABF872.arn}",
+ "runtime": "nodejs20.x",
+ "s3_bucket": "${aws_s3_bucket.Code.bucket}",
+ "s3_key": "${aws_s3_object.defaultapi_get_test_path0_S3Object_B2DEDF01.key}",
"timeout": 60,
"vpc_config": {
"security_group_ids": [],
@@ -202,173 +319,186 @@ module.exports = function({ }) {
}
},
"aws_lambda_permission": {
- "Api_api_permission-GET-07205281_2EFE8EB1": {
+ "apiforrootpath_api_permission-GET-c2e3ffa8_13544034": {
+ "//": {
+ "metadata": {
+ "path": "root/Default/Default/api for root path/api/permission-GET-c2e3ffa8",
+ "uniqueId": "apiforrootpath_api_permission-GET-c2e3ffa8_13544034"
+ }
+ },
+ "action": "lambda:InvokeFunction",
+ "function_name": "${aws_lambda_function.apiforrootpath_get_0_057FC713.function_name}",
+ "principal": "apigateway.amazonaws.com",
+ "source_arn": "${aws_api_gateway_rest_api.apiforrootpath_api_53DF977A.execution_arn}/*/GET/",
+ "statement_id": "AllowExecutionFromAPIGateway-GET-c2e3ffa8"
+ },
+ "defaultapi_permission-GET-07205281_663F50CE": {
"//": {
"metadata": {
- "path": "root/Default/Default/Api/api/permission-GET-07205281",
- "uniqueId": "Api_api_permission-GET-07205281_2EFE8EB1"
+ "path": "root/Default/Default/default api/api/permission-GET-07205281",
+ "uniqueId": "defaultapi_permission-GET-07205281_663F50CE"
}
},
"action": "lambda:InvokeFunction",
- "function_name": "${aws_lambda_function.Api_get_test_path0_645426B9.function_name}",
+ "function_name": "${aws_lambda_function.defaultapi_get_test_path0_B7A07AB2.function_name}",
"principal": "apigateway.amazonaws.com",
- "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/t/{param}",
+ "source_arn": "${aws_api_gateway_rest_api.defaultapi_D23C5D48.execution_arn}/*/GET/t/{param}",
"statement_id": "AllowExecutionFromAPIGateway-GET-07205281"
},
- "Api_api_permission-GET-16d10b32_C81601CA": {
+ "defaultapi_permission-GET-16d10b32_22F0CCAD": {
"//": {
"metadata": {
- "path": "root/Default/Default/Api/api/permission-GET-16d10b32",
- "uniqueId": "Api_api_permission-GET-16d10b32_C81601CA"
+ "path": "root/Default/Default/default api/api/permission-GET-16d10b32",
+ "uniqueId": "defaultapi_permission-GET-16d10b32_22F0CCAD"
}
},
"action": "lambda:InvokeFunction",
- "function_name": "${aws_lambda_function.Api_get_test_path0_645426B9.function_name}",
+ "function_name": "${aws_lambda_function.defaultapi_get_test_path0_B7A07AB2.function_name}",
"principal": "apigateway.amazonaws.com",
- "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/test/path/.withDots/{param}/{param-dash}/x",
+ "source_arn": "${aws_api_gateway_rest_api.defaultapi_D23C5D48.execution_arn}/*/GET/test/path/.withDots/{param}/{param-dash}/x",
"statement_id": "AllowExecutionFromAPIGateway-GET-16d10b32"
},
- "Api_api_permission-GET-1dad4331_32F54094": {
+ "defaultapi_permission-GET-1dad4331_915FA0B1": {
"//": {
"metadata": {
- "path": "root/Default/Default/Api/api/permission-GET-1dad4331",
- "uniqueId": "Api_api_permission-GET-1dad4331_32F54094"
+ "path": "root/Default/Default/default api/api/permission-GET-1dad4331",
+ "uniqueId": "defaultapi_permission-GET-1dad4331_915FA0B1"
}
},
"action": "lambda:InvokeFunction",
- "function_name": "${aws_lambda_function.Api_get_test_path0_645426B9.function_name}",
+ "function_name": "${aws_lambda_function.defaultapi_get_test_path0_B7A07AB2.function_name}",
"principal": "apigateway.amazonaws.com",
- "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/{param}",
+ "source_arn": "${aws_api_gateway_rest_api.defaultapi_D23C5D48.execution_arn}/*/GET/{param}",
"statement_id": "AllowExecutionFromAPIGateway-GET-1dad4331"
},
- "Api_api_permission-GET-4835e6c5_6B499B93": {
+ "defaultapi_permission-GET-4835e6c5_6396A6A0": {
"//": {
"metadata": {
- "path": "root/Default/Default/Api/api/permission-GET-4835e6c5",
- "uniqueId": "Api_api_permission-GET-4835e6c5_6B499B93"
+ "path": "root/Default/Default/default api/api/permission-GET-4835e6c5",
+ "uniqueId": "defaultapi_permission-GET-4835e6c5_6396A6A0"
}
},
"action": "lambda:InvokeFunction",
- "function_name": "${aws_lambda_function.Api_get_test_path0_645426B9.function_name}",
+ "function_name": "${aws_lambda_function.defaultapi_get_test_path0_B7A07AB2.function_name}",
"principal": "apigateway.amazonaws.com",
- "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/test/path/{param}",
+ "source_arn": "${aws_api_gateway_rest_api.defaultapi_D23C5D48.execution_arn}/*/GET/test/path/{param}",
"statement_id": "AllowExecutionFromAPIGateway-GET-4835e6c5"
},
- "Api_api_permission-GET-525feabe_2C6C9790": {
+ "defaultapi_permission-GET-525feabe_7C43C625": {
"//": {
"metadata": {
- "path": "root/Default/Default/Api/api/permission-GET-525feabe",
- "uniqueId": "Api_api_permission-GET-525feabe_2C6C9790"
+ "path": "root/Default/Default/default api/api/permission-GET-525feabe",
+ "uniqueId": "defaultapi_permission-GET-525feabe_7C43C625"
}
},
"action": "lambda:InvokeFunction",
- "function_name": "${aws_lambda_function.Api_get_test_path0_645426B9.function_name}",
+ "function_name": "${aws_lambda_function.defaultapi_get_test_path0_B7A07AB2.function_name}",
"principal": "apigateway.amazonaws.com",
- "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/test/param/is/{last}",
+ "source_arn": "${aws_api_gateway_rest_api.defaultapi_D23C5D48.execution_arn}/*/GET/test/param/is/{last}",
"statement_id": "AllowExecutionFromAPIGateway-GET-525feabe"
},
- "Api_api_permission-GET-815194c4_25BC69FF": {
+ "defaultapi_permission-GET-815194c4_428713F1": {
"//": {
"metadata": {
- "path": "root/Default/Default/Api/api/permission-GET-815194c4",
- "uniqueId": "Api_api_permission-GET-815194c4_25BC69FF"
+ "path": "root/Default/Default/default api/api/permission-GET-815194c4",
+ "uniqueId": "defaultapi_permission-GET-815194c4_428713F1"
}
},
"action": "lambda:InvokeFunction",
- "function_name": "${aws_lambda_function.Api_get_test_path0_645426B9.function_name}",
+ "function_name": "${aws_lambda_function.defaultapi_get_test_path0_B7A07AB2.function_name}",
"principal": "apigateway.amazonaws.com",
- "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/test/pa-th/{with}/two/{variable_s}/f?bla=5&b=6",
+ "source_arn": "${aws_api_gateway_rest_api.defaultapi_D23C5D48.execution_arn}/*/GET/test/pa-th/{with}/two/{variable_s}/f?bla=5&b=6",
"statement_id": "AllowExecutionFromAPIGateway-GET-815194c4"
},
- "Api_api_permission-GET-83a11f17_56732227": {
+ "defaultapi_permission-GET-83a11f17_64B234AF": {
"//": {
"metadata": {
- "path": "root/Default/Default/Api/api/permission-GET-83a11f17",
- "uniqueId": "Api_api_permission-GET-83a11f17_56732227"
+ "path": "root/Default/Default/default api/api/permission-GET-83a11f17",
+ "uniqueId": "defaultapi_permission-GET-83a11f17_64B234AF"
}
},
"action": "lambda:InvokeFunction",
- "function_name": "${aws_lambda_function.Api_get_test_path0_645426B9.function_name}",
+ "function_name": "${aws_lambda_function.defaultapi_get_test_path0_B7A07AB2.function_name}",
"principal": "apigateway.amazonaws.com",
- "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/test/path",
+ "source_arn": "${aws_api_gateway_rest_api.defaultapi_D23C5D48.execution_arn}/*/GET/test/path",
"statement_id": "AllowExecutionFromAPIGateway-GET-83a11f17"
},
- "Api_api_permission-GET-8d6a8a39_19EE1671": {
+ "defaultapi_permission-GET-8d6a8a39_2877CE15": {
"//": {
"metadata": {
- "path": "root/Default/Default/Api/api/permission-GET-8d6a8a39",
- "uniqueId": "Api_api_permission-GET-8d6a8a39_19EE1671"
+ "path": "root/Default/Default/default api/api/permission-GET-8d6a8a39",
+ "uniqueId": "defaultapi_permission-GET-8d6a8a39_2877CE15"
}
},
"action": "lambda:InvokeFunction",
- "function_name": "${aws_lambda_function.Api_get_test_path0_645426B9.function_name}",
+ "function_name": "${aws_lambda_function.defaultapi_get_test_path0_B7A07AB2.function_name}",
"principal": "apigateway.amazonaws.com",
- "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/test/regular/path",
+ "source_arn": "${aws_api_gateway_rest_api.defaultapi_D23C5D48.execution_arn}/*/GET/test/regular/path",
"statement_id": "AllowExecutionFromAPIGateway-GET-8d6a8a39"
},
- "Api_api_permission-GET-8dfdf611_2D4250A0": {
+ "defaultapi_permission-GET-8dfdf611_AE7542CB": {
"//": {
"metadata": {
- "path": "root/Default/Default/Api/api/permission-GET-8dfdf611",
- "uniqueId": "Api_api_permission-GET-8dfdf611_2D4250A0"
+ "path": "root/Default/Default/default api/api/permission-GET-8dfdf611",
+ "uniqueId": "defaultapi_permission-GET-8dfdf611_AE7542CB"
}
},
"action": "lambda:InvokeFunction",
- "function_name": "${aws_lambda_function.Api_get_test_path0_645426B9.function_name}",
+ "function_name": "${aws_lambda_function.defaultapi_get_test_path0_B7A07AB2.function_name}",
"principal": "apigateway.amazonaws.com",
- "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/test/alphanumer1cPa_th",
+ "source_arn": "${aws_api_gateway_rest_api.defaultapi_D23C5D48.execution_arn}/*/GET/test/alphanumer1cPa_th",
"statement_id": "AllowExecutionFromAPIGateway-GET-8dfdf611"
},
- "Api_api_permission-GET-b171b58d_9A7757E3": {
+ "defaultapi_permission-GET-b171b58d_067C9334": {
"//": {
"metadata": {
- "path": "root/Default/Default/Api/api/permission-GET-b171b58d",
- "uniqueId": "Api_api_permission-GET-b171b58d_9A7757E3"
+ "path": "root/Default/Default/default api/api/permission-GET-b171b58d",
+ "uniqueId": "defaultapi_permission-GET-b171b58d_067C9334"
}
},
"action": "lambda:InvokeFunction",
- "function_name": "${aws_lambda_function.Api_get_test_path0_645426B9.function_name}",
+ "function_name": "${aws_lambda_function.defaultapi_get_test_path0_B7A07AB2.function_name}",
"principal": "apigateway.amazonaws.com",
- "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/test/segment1/segment2?query=value1&query2=value2",
+ "source_arn": "${aws_api_gateway_rest_api.defaultapi_D23C5D48.execution_arn}/*/GET/test/segment1/segment2?query=value1&query2=value2",
"statement_id": "AllowExecutionFromAPIGateway-GET-b171b58d"
},
- "Api_api_permission-GET-d0938f9f_157E2FB0": {
+ "defaultapi_permission-GET-d0938f9f_6A7F8B88": {
"//": {
"metadata": {
- "path": "root/Default/Default/Api/api/permission-GET-d0938f9f",
- "uniqueId": "Api_api_permission-GET-d0938f9f_157E2FB0"
+ "path": "root/Default/Default/default api/api/permission-GET-d0938f9f",
+ "uniqueId": "defaultapi_permission-GET-d0938f9f_6A7F8B88"
}
},
"action": "lambda:InvokeFunction",
- "function_name": "${aws_lambda_function.Api_get_test_path0_645426B9.function_name}",
+ "function_name": "${aws_lambda_function.defaultapi_get_test_path0_B7A07AB2.function_name}",
"principal": "apigateway.amazonaws.com",
- "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/test/regular/path/{param}",
+ "source_arn": "${aws_api_gateway_rest_api.defaultapi_D23C5D48.execution_arn}/*/GET/test/regular/path/{param}",
"statement_id": "AllowExecutionFromAPIGateway-GET-d0938f9f"
},
- "Api_api_permission-GET-ecbc2deb_702B770C": {
+ "defaultapi_permission-GET-ecbc2deb_62CFBA33": {
"//": {
"metadata": {
- "path": "root/Default/Default/Api/api/permission-GET-ecbc2deb",
- "uniqueId": "Api_api_permission-GET-ecbc2deb_702B770C"
+ "path": "root/Default/Default/default api/api/permission-GET-ecbc2deb",
+ "uniqueId": "defaultapi_permission-GET-ecbc2deb_62CFBA33"
}
},
"action": "lambda:InvokeFunction",
- "function_name": "${aws_lambda_function.Api_get_test_path0_645426B9.function_name}",
+ "function_name": "${aws_lambda_function.defaultapi_get_test_path0_B7A07AB2.function_name}",
"principal": "apigateway.amazonaws.com",
- "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/test/segment1/{param1}/segment2?query1=value1?query2=value2",
+ "source_arn": "${aws_api_gateway_rest_api.defaultapi_D23C5D48.execution_arn}/*/GET/test/segment1/{param1}/segment2?query1=value1?query2=value2",
"statement_id": "AllowExecutionFromAPIGateway-GET-ecbc2deb"
},
- "Api_api_permission-GET-f2bb7c42_E8380F56": {
+ "defaultapi_permission-GET-f2bb7c42_8625FCC2": {
"//": {
"metadata": {
- "path": "root/Default/Default/Api/api/permission-GET-f2bb7c42",
- "uniqueId": "Api_api_permission-GET-f2bb7c42_E8380F56"
+ "path": "root/Default/Default/default api/api/permission-GET-f2bb7c42",
+ "uniqueId": "defaultapi_permission-GET-f2bb7c42_8625FCC2"
}
},
"action": "lambda:InvokeFunction",
- "function_name": "${aws_lambda_function.Api_get_test_path0_645426B9.function_name}",
+ "function_name": "${aws_lambda_function.defaultapi_get_test_path0_B7A07AB2.function_name}",
"principal": "apigateway.amazonaws.com",
- "source_arn": "${aws_api_gateway_rest_api.Api_api_91C07D84.execution_arn}/*/GET/test/path.withDots",
+ "source_arn": "${aws_api_gateway_rest_api.defaultapi_D23C5D48.execution_arn}/*/GET/test/path.withDots",
"statement_id": "AllowExecutionFromAPIGateway-GET-f2bb7c42"
}
},
@@ -384,11 +514,22 @@ module.exports = function({ }) {
}
},
"aws_s3_object": {
- "Api_get_test_path0_S3Object_F8C2A41F": {
+ "apiforrootpath_get_0_S3Object_426DA1A7": {
+ "//": {
+ "metadata": {
+ "path": "root/Default/Default/api for root path/get_0/S3Object",
+ "uniqueId": "apiforrootpath_get_0_S3Object_426DA1A7"
+ }
+ },
+ "bucket": "${aws_s3_bucket.Code.bucket}",
+ "key": "",
+ "source": ""
+ },
+ "defaultapi_get_test_path0_S3Object_B2DEDF01": {
"//": {
"metadata": {
- "path": "root/Default/Default/Api/get_test_path0/S3Object",
- "uniqueId": "Api_get_test_path0_S3Object_F8C2A41F"
+ "path": "root/Default/Default/default api/get_test_path0/S3Object",
+ "uniqueId": "defaultapi_get_test_path0_S3Object_B2DEDF01"
}
},
"bucket": "${aws_s3_bucket.Code.bucket}",
@@ -411,6 +552,7 @@ const std = $stdlib.std;
const $helpers = $stdlib.helpers;
const $extern = $helpers.createExternRequire(__dirname);
const cloud = $stdlib.cloud;
+const expect = $stdlib.expect;
class $Root extends $stdlib.std.Resource {
constructor($scope, $id) {
super($scope, $id);
@@ -446,30 +588,30 @@ class $Root extends $stdlib.std.Resource {
});
}
}
- const api = this.node.root.new("@winglang/sdk.cloud.Api", cloud.Api, this, "Api");
+ const api = this.node.root.new("@winglang/sdk.cloud.Api", cloud.Api, this, "default api");
const handler = new $Closure1(this, "$Closure1");
- const testInvalidPath = ((path) => {
+ const testInvalidPath = ((path, apiInstance) => {
let error = "";
const expected = String.raw({ raw: ["Invalid path ", ". Url parts can only contain alpha-numeric chars, \"-\", \"_\" and \".\". Params can only contain alpha-numeric chars and \"_\"."] }, path);
try {
- (api.get(path, handler));
+ ((apiInstance ?? api).get(path, handler));
}
catch ($error_e) {
const e = $error_e.message;
error = e;
}
- $helpers.assert($helpers.eq(error, expected), "error == expected");
+ (expect.Util.equal(error, expected));
});
- const testValidPath = ((path) => {
+ const testValidPath = ((path, apiInstance) => {
let error = "";
try {
- (api.get(path, handler));
+ ((apiInstance ?? api).get(path, handler));
}
catch ($error_e) {
const e = $error_e.message;
error = e;
}
- $helpers.assert($helpers.eq(error, ""), "error == \"\"");
+ (expect.Util.equal(error, ""));
});
(testInvalidPath("/test/:sup{er/:annoying//path"));
(testInvalidPath("/test/{::another:annoying:path}"));
@@ -501,6 +643,7 @@ class $Root extends $stdlib.std.Resource {
(testValidPath("/test/segment1/segment2?query=value1&query2=value2"));
(testValidPath("/test/path.withDots"));
(testValidPath("/test/path/.withDots/:param/:param-dash/x"));
+ (testValidPath("/", this.node.root.new("@winglang/sdk.cloud.Api", cloud.Api, this, "api for root path")));
}
}
const $PlatformManager = new $stdlib.platform.PlatformManager({platformPaths: $platforms});