lambda-api-decorators-cdk 0.4.6__tar.gz → 0.4.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/.github/workflows/release.yml +3 -0
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/AGENTS.md +8 -0
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/PKG-INFO +1 -1
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/pyproject.toml +3 -0
- lambda_api_decorators_cdk-0.4.7/src/lambda_api_decorators_cdk/_agent/api-contract.json +23 -0
- lambda_api_decorators_cdk-0.4.7/src/lambda_api_decorators_cdk/_agent/behavior.md +15 -0
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/src/lambda_api_decorators_cdk.egg-info/PKG-INFO +1 -1
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/src/lambda_api_decorators_cdk.egg-info/SOURCES.txt +5 -1
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/src/lambda_api_decorators_cdk.egg-info/scm_file_list.json +5 -1
- lambda_api_decorators_cdk-0.4.7/src/lambda_api_decorators_cdk.egg-info/scm_version.json +8 -0
- lambda_api_decorators_cdk-0.4.7/tests/test_contract_packaging.py +21 -0
- lambda_api_decorators_cdk-0.4.7/tests/verify_contract_artifacts.py +38 -0
- lambda_api_decorators_cdk-0.4.6/src/lambda_api_decorators_cdk.egg-info/scm_version.json +0 -8
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/.github/workflows/tests.yml +0 -0
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/.gitignore +0 -0
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/LICENSE +0 -0
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/README.md +0 -0
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/setup.cfg +0 -0
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/src/lambda_api_decorators_cdk/__init__.py +0 -0
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/src/lambda_api_decorators_cdk/api_type.py +0 -0
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/src/lambda_api_decorators_cdk/ast_helper.py +0 -0
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/src/lambda_api_decorators_cdk/lambda_api.py +0 -0
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/src/lambda_api_decorators_cdk/lambda_api_config.py +0 -0
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/src/lambda_api_decorators_cdk/resource_builder.py +0 -0
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/src/lambda_api_decorators_cdk/source_layout.py +0 -0
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/src/lambda_api_decorators_cdk.egg-info/dependency_links.txt +0 -0
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/src/lambda_api_decorators_cdk.egg-info/requires.txt +0 -0
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/src/lambda_api_decorators_cdk.egg-info/top_level.txt +0 -0
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/tests/conftest.py +0 -0
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/tests/test_ast_decorator_invocations.py +0 -0
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/tests/test_ast_helper.py +0 -0
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/tests/test_auth_ast.py +0 -0
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/tests/test_authorization_diagnostics.py +0 -0
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/tests/test_authorization_http.py +0 -0
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/tests/test_authorization_lambda_api.py +0 -0
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/tests/test_authorization_resolution.py +0 -0
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/tests/test_authorization_rest.py +0 -0
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/tests/test_authorizer_config.py +0 -0
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/tests/test_config_override_diagnostics.py +0 -0
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/tests/test_config_resource_registries.py +0 -0
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/tests/test_http_builder.py +0 -0
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/tests/test_lambda_api.py +0 -0
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/tests/test_lambda_api_config.py +0 -0
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/tests/test_lambda_function.py +0 -0
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/tests/test_layer_autodiscovery.py +0 -0
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/tests/test_packaging_current.py +0 -0
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/tests/test_permission_resolution.py +0 -0
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/tests/test_public_api.py +0 -0
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/tests/test_python_compatibility.py +0 -0
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/tests/test_resource_builder_options.py +0 -0
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/tests/test_resource_builder_state.py +0 -0
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/tests/test_resource_graph.py +0 -0
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/tests/test_resource_registries.py +0 -0
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/tests/test_rest_builder.py +0 -0
- {lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/tests/test_source_layout.py +0 -0
|
@@ -230,3 +230,11 @@ Keep public APIs intentionally small.
|
|
|
230
230
|
When an implementation detail is not useful to callers, keep it private.
|
|
231
231
|
|
|
232
232
|
If repository behavior contradicts an assumption in the task, report the conflict rather than silently redesigning unrelated code.
|
|
233
|
+
|
|
234
|
+
## Packaged contract
|
|
235
|
+
|
|
236
|
+
When available, use `lambda-api-decorators-development` and load the local
|
|
237
|
+
`_agent/api-contract.json` and `_agent/behavior.md` before changing public
|
|
238
|
+
behavior. Public changes update the contract and focused tests together; the
|
|
239
|
+
contract contains no package version or future release. Validate focused and
|
|
240
|
+
full tests, `compileall`, built artifacts, and `git diff --check`.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: lambda-api-decorators-cdk
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.7
|
|
4
4
|
Summary: AWS CDK integration for Lambda API Decorators. Generate AWS Lambda and API Gateway infrastructure from decorated Python handlers.
|
|
5
5
|
Author: Mateo Marcos, Emanuel Arguinarena, Lucas Picchi
|
|
6
6
|
License: MIT License
|
|
@@ -99,6 +99,9 @@ Repository = "https://github.com/infrastructure-as-decorator/lambda-api-decorato
|
|
|
99
99
|
# If you are using a different build backend, you will need to change this.
|
|
100
100
|
[tool.setuptools]
|
|
101
101
|
|
|
102
|
+
[tool.setuptools.package-data]
|
|
103
|
+
lambda_api_decorators_cdk = ["_agent/api-contract.json", "_agent/behavior.md"]
|
|
104
|
+
|
|
102
105
|
[tool.setuptools_scm]
|
|
103
106
|
tag_regex = '^v(?P<version>[0-9]+\.[0-9]+\.[0-9]+)$'
|
|
104
107
|
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schema_version": "1.0",
|
|
3
|
+
"distribution": "lambda-api-decorators-cdk",
|
|
4
|
+
"import_package": "lambda_api_decorators_cdk",
|
|
5
|
+
"exports": ["ApiType", "SourceLayout", "LambdaApi", "LambdaApiConfig", "ResourceBuilder"],
|
|
6
|
+
"functions": [],
|
|
7
|
+
"decorators": [],
|
|
8
|
+
"classes": [
|
|
9
|
+
{"name": "ApiType", "signature": "ApiType", "methods": [], "members": [{"name": "REST", "value": "rest"}, {"name": "HTTP", "value": "http"}]},
|
|
10
|
+
{"name": "SourceLayout", "signature": "SourceLayout", "methods": [], "members": [{"name": "ROOT", "value": "root"}, {"name": "SERVICE", "value": "service"}]},
|
|
11
|
+
{"name": "LambdaApi", "signature": "LambdaApi(scope: Construct, construct_id: str, *, lambda_path: str, source_layout: SourceLayout = SourceLayout.ROOT, layers_path: Optional[str] = None, api = None, api_type: Optional[ApiType] = None, config: Optional[LambdaApiConfig] = None)", "methods": [{"name": "api", "kind": "property", "returns": {"type": "IRestApi | HttpApi"}}, {"name": "api_type", "kind": "property", "returns": {"type": "ApiType"}}]},
|
|
12
|
+
{"name": "LambdaApiConfig", "signature": "LambdaApiConfig(*, runtime=None, timeout=None, memory_size=None, vpc=None, vpc_subnets=None, role=None, layers=None, security_groups=None, environment=None, dynamodb_tables=None, s3_buckets=None, authorizers=None, default_authorizer=None, default_runtime=None, default_role=None, common_environment=None, role_registry=None, environment_registry=None, layer_registry=None, security_group_registry=None, vpc_registry=None, dynamodb_table_registry=None, s3_bucket_registry=None, authorizer_registry=None)", "methods": [
|
|
13
|
+
{"name": "set_default_runtime", "signature": "set_default_runtime(runtime: Optional[Runtime]) -> None"}, {"name": "set_default_timeout", "signature": "set_default_timeout(timeout: Optional[Duration]) -> None"}, {"name": "set_default_memory_size", "signature": "set_default_memory_size(memory_size: Optional[int]) -> None"}, {"name": "set_default_vpc", "signature": "set_default_vpc(vpc: Optional[IVpc], vpc_subnets: Optional[SubnetSelection] = None) -> None"}, {"name": "set_default_role", "signature": "set_default_role(role: Optional[IRole]) -> None"},
|
|
14
|
+
{"name": "add_common_layer", "signature": "add_common_layer(layer: ILayerVersion) -> None"}, {"name": "add_common_security_group", "signature": "add_common_security_group(security_group: ISecurityGroup) -> None"}, {"name": "add_custom_runtime", "signature": "add_custom_runtime(key: str, runtime: Runtime) -> None"}, {"name": "add_custom_role", "signature": "add_custom_role(key: str, role: IRole) -> None"}, {"name": "add_custom_layer", "signature": "add_custom_layer(key: str, layer: ILayerVersion) -> None"}, {"name": "add_custom_environment", "signature": "add_custom_environment(key: str, value: str) -> None"}, {"name": "add_custom_security_group", "signature": "add_custom_security_group(key: str, security_group: ISecurityGroup) -> None"}, {"name": "add_custom_vpc", "signature": "add_custom_vpc(key: str, vpc: IVpc, vpc_subnets: Optional[SubnetSelection] = None) -> None"},
|
|
15
|
+
{"name": "add_dynamodb_table", "signature": "add_dynamodb_table(key: str, table: ITable) -> None"}, {"name": "add_s3_bucket", "signature": "add_s3_bucket(key: str, bucket: IBucket) -> None"}, {"name": "add_authorizer", "signature": "add_authorizer(key: str, authorizer: object) -> None"}, {"name": "register_role", "signature": "register_role(key: str, role: IRole) -> None"}, {"name": "register_environment", "signature": "register_environment(key: str, value: Mapping[str, str]) -> None"}, {"name": "register_layer", "signature": "register_layer(key: str, layer: ILayerVersion) -> None"}, {"name": "register_security_group", "signature": "register_security_group(key: str, security_group: ISecurityGroup) -> None"}, {"name": "register_vpc", "signature": "register_vpc(key: str, vpc: IVpc, vpc_subnets: Optional[SubnetSelection] = None) -> None"}, {"name": "register_dynamodb_table", "signature": "register_dynamodb_table(key: str, table: ITable) -> None"}, {"name": "register_s3_bucket", "signature": "register_s3_bucket(key: str, bucket: IBucket) -> None"}, {"name": "register_authorizer", "signature": "register_authorizer(key: str, authorizer: object) -> None"}, {"name": "set_default_authorizer", "signature": "set_default_authorizer(key: Optional[str]) -> None"}
|
|
16
|
+
]},
|
|
17
|
+
{"name": "ResourceBuilder", "signature": "ResourceBuilder(default_runtime=None, default_timeout=None, default_memory_size=None, default_vpc=None, default_role=None, common_layers=None, common_security_groups=None, common_environments=None, custom_runtimes=None, custom_roles=None, custom_layers=None, custom_environments=None, custom_security_groups=None, custom_vpcs=None, dynamodb_tables=None, s3_buckets=None, authorizers=None, default_authorizer=None)", "methods": [
|
|
18
|
+
{"name": "set_default_runtime"}, {"name": "set_default_timeout"}, {"name": "set_default_memory_size"}, {"name": "set_default_vpc"}, {"name": "set_default_role"}, {"name": "add_common_layer"}, {"name": "add_common_security_group"}, {"name": "add_custom_vpc"}, {"name": "add_custom_environment"}, {"name": "add_custom_runtime"}, {"name": "add_custom_role"}, {"name": "add_custom_layer"}, {"name": "add_custom_security_group"}, {"name": "get_default_runtime"}, {"name": "get_default_timeout"}, {"name": "get_default_memory_size"}, {"name": "get_default_vpc"}, {"name": "get_default_role"}, {"name": "get_common_layers"}, {"name": "get_common_layer"}, {"name": "get_common_security_groups"}, {"name": "get_common_security_group"}, {"name": "get_common_environments"}, {"name": "get_common_environment"}, {"name": "get_custom_layer"}, {"name": "get_custom_roles"}, {"name": "get_custom_role"}, {"name": "get_custom_security_group"}, {"name": "get_custom_environment"}, {"name": "get_custom_runtime"}, {"name": "get_custom_vpc"}, {"name": "build"}, {"name": "build_http"}, {"name": "get_options"}, {"name": "build_from_graph"}, {"name": "build_http_from_graph"}
|
|
19
|
+
]}
|
|
20
|
+
],
|
|
21
|
+
"exceptions": [],
|
|
22
|
+
"behavior_ref": "behavior.md"
|
|
23
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# CDK behavior
|
|
2
|
+
|
|
3
|
+
## Construction and precedence
|
|
4
|
+
|
|
5
|
+
`LambdaApi` selects REST by default, infers the API family from a supplied concrete REST or HTTP API, and rejects a conflicting explicit `api_type`. Configuration must be complete before construction; `LambdaApiConfig` creates an isolated `ResourceBuilder` snapshot and does not deep-copy CDK constructs.
|
|
6
|
+
|
|
7
|
+
Explicit configuration wins over convention. Runtime, role, environment, layer, VPC, security group, table, bucket, and authorizer registries resolve named decorator values. A registry is a lookup mechanism, not an authorization grant.
|
|
8
|
+
|
|
9
|
+
## Routes and authorization
|
|
10
|
+
|
|
11
|
+
The runtime contract permits one HTTP route per callable. CDK discovers those declarations and builds the matching REST or HTTP resources. `public` suppresses the effective authorizer for that callable; otherwise a callable override, the configured default authorizer, or no authorizer is resolved according to the current builder behavior.
|
|
12
|
+
|
|
13
|
+
## Grants
|
|
14
|
+
|
|
15
|
+
`grant_dynamodb` and `grant_s3` resolve either a registered logical resource or a physical resource name. `read` applies read access and `write` applies cumulative write access as implemented by the builder. Generic `permission` statements are applied separately. Missing registry entries, invalid authorizers, conflicting defaults, and unsupported API/resource combinations produce errors or CDK diagnostics rather than silently changing the runtime metadata.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: lambda-api-decorators-cdk
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.7
|
|
4
4
|
Summary: AWS CDK integration for Lambda API Decorators. Generate AWS Lambda and API Gateway infrastructure from decorated Python handlers.
|
|
5
5
|
Author: Mateo Marcos, Emanuel Arguinarena, Lucas Picchi
|
|
6
6
|
License: MIT License
|
|
@@ -19,6 +19,8 @@ src/lambda_api_decorators_cdk.egg-info/requires.txt
|
|
|
19
19
|
src/lambda_api_decorators_cdk.egg-info/scm_file_list.json
|
|
20
20
|
src/lambda_api_decorators_cdk.egg-info/scm_version.json
|
|
21
21
|
src/lambda_api_decorators_cdk.egg-info/top_level.txt
|
|
22
|
+
src/lambda_api_decorators_cdk/_agent/api-contract.json
|
|
23
|
+
src/lambda_api_decorators_cdk/_agent/behavior.md
|
|
22
24
|
tests/conftest.py
|
|
23
25
|
tests/test_ast_decorator_invocations.py
|
|
24
26
|
tests/test_ast_helper.py
|
|
@@ -31,6 +33,7 @@ tests/test_authorization_rest.py
|
|
|
31
33
|
tests/test_authorizer_config.py
|
|
32
34
|
tests/test_config_override_diagnostics.py
|
|
33
35
|
tests/test_config_resource_registries.py
|
|
36
|
+
tests/test_contract_packaging.py
|
|
34
37
|
tests/test_http_builder.py
|
|
35
38
|
tests/test_lambda_api.py
|
|
36
39
|
tests/test_lambda_api_config.py
|
|
@@ -45,4 +48,5 @@ tests/test_resource_builder_state.py
|
|
|
45
48
|
tests/test_resource_graph.py
|
|
46
49
|
tests/test_resource_registries.py
|
|
47
50
|
tests/test_rest_builder.py
|
|
48
|
-
tests/test_source_layout.py
|
|
51
|
+
tests/test_source_layout.py
|
|
52
|
+
tests/verify_contract_artifacts.py
|
|
@@ -8,6 +8,8 @@
|
|
|
8
8
|
"README.md",
|
|
9
9
|
"pyproject.toml",
|
|
10
10
|
"src/lambda_api_decorators_cdk/__init__.py",
|
|
11
|
+
"src/lambda_api_decorators_cdk/_agent/api-contract.json",
|
|
12
|
+
"src/lambda_api_decorators_cdk/_agent/behavior.md",
|
|
11
13
|
"src/lambda_api_decorators_cdk/api_type.py",
|
|
12
14
|
"src/lambda_api_decorators_cdk/ast_helper.py",
|
|
13
15
|
"src/lambda_api_decorators_cdk/lambda_api.py",
|
|
@@ -26,6 +28,7 @@
|
|
|
26
28
|
"tests/test_authorizer_config.py",
|
|
27
29
|
"tests/test_config_override_diagnostics.py",
|
|
28
30
|
"tests/test_config_resource_registries.py",
|
|
31
|
+
"tests/test_contract_packaging.py",
|
|
29
32
|
"tests/test_http_builder.py",
|
|
30
33
|
"tests/test_lambda_api.py",
|
|
31
34
|
"tests/test_lambda_api_config.py",
|
|
@@ -40,6 +43,7 @@
|
|
|
40
43
|
"tests/test_resource_graph.py",
|
|
41
44
|
"tests/test_resource_registries.py",
|
|
42
45
|
"tests/test_rest_builder.py",
|
|
43
|
-
"tests/test_source_layout.py"
|
|
46
|
+
"tests/test_source_layout.py",
|
|
47
|
+
"tests/verify_contract_artifacts.py"
|
|
44
48
|
]
|
|
45
49
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import json
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
def test_public_contract_is_present_and_version_free():
|
|
6
|
+
contract_path = Path(__file__).parents[1] / "src/lambda_api_decorators_cdk/_agent/api-contract.json"
|
|
7
|
+
contract = json.loads(contract_path.read_text())
|
|
8
|
+
assert contract["schema_version"] == "1.0"
|
|
9
|
+
assert "version" not in contract
|
|
10
|
+
assert contract["exports"] == ["ApiType", "SourceLayout", "LambdaApi", "LambdaApiConfig", "ResourceBuilder"]
|
|
11
|
+
assert contract_path.with_name("behavior.md").read_text().strip()
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def test_contract_covers_public_configuration_and_types():
|
|
15
|
+
contract_path = Path(__file__).parents[1] / "src/lambda_api_decorators_cdk/_agent/api-contract.json"
|
|
16
|
+
contract = json.loads(contract_path.read_text())
|
|
17
|
+
classes = {item["name"]: item for item in contract["classes"]}
|
|
18
|
+
assert {"LambdaApi", "LambdaApiConfig", "ResourceBuilder", "ApiType", "SourceLayout"} <= classes.keys()
|
|
19
|
+
config_methods = {item["name"] for item in classes["LambdaApiConfig"]["methods"]}
|
|
20
|
+
assert {"register_role", "register_environment", "register_authorizer", "set_default_authorizer"} <= config_methods
|
|
21
|
+
assert classes["LambdaApi"]["methods"][0]["kind"] == "property"
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"""Verify that built CDK artifacts carry the public contract."""
|
|
2
|
+
import json
|
|
3
|
+
import sys
|
|
4
|
+
import tarfile
|
|
5
|
+
import zipfile
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def validate(payload):
|
|
10
|
+
required = {"schema_version", "distribution", "import_package", "exports", "functions", "decorators", "classes", "exceptions"}
|
|
11
|
+
assert payload["schema_version"] == "1.0"
|
|
12
|
+
assert required <= payload.keys()
|
|
13
|
+
assert "version" not in payload
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def main(dist_dir):
|
|
17
|
+
dist = Path(dist_dir)
|
|
18
|
+
wheels = list(dist.glob("*.whl"))
|
|
19
|
+
sdists = list(dist.glob("*.tar.gz"))
|
|
20
|
+
assert len(wheels) == len(sdists) == 1, (wheels, sdists)
|
|
21
|
+
with zipfile.ZipFile(wheels[0]) as archive:
|
|
22
|
+
names = archive.namelist()
|
|
23
|
+
contract = [name for name in names if name.endswith("/_agent/api-contract.json")]
|
|
24
|
+
behavior = [name for name in names if name.endswith("/_agent/behavior.md")]
|
|
25
|
+
assert len(contract) == len(behavior) == 1, (contract, behavior)
|
|
26
|
+
validate(json.loads(archive.read(contract[0])))
|
|
27
|
+
with tarfile.open(sdists[0], "r:gz") as archive:
|
|
28
|
+
names = archive.getnames()
|
|
29
|
+
contract = [name for name in names if name.endswith("/_agent/api-contract.json")]
|
|
30
|
+
behavior = [name for name in names if name.endswith("/_agent/behavior.md")]
|
|
31
|
+
assert len(contract) == len(behavior) == 1, (contract, behavior)
|
|
32
|
+
member = archive.extractfile(contract[0])
|
|
33
|
+
assert member is not None
|
|
34
|
+
validate(json.load(member))
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
if __name__ == "__main__":
|
|
38
|
+
main(sys.argv[1])
|
{lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/.github/workflows/tests.yml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/tests/test_ast_helper.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/tests/test_authorization_http.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/tests/test_authorization_rest.py
RENAMED
|
File without changes
|
{lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/tests/test_authorizer_config.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/tests/test_http_builder.py
RENAMED
|
File without changes
|
{lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/tests/test_lambda_api.py
RENAMED
|
File without changes
|
{lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/tests/test_lambda_api_config.py
RENAMED
|
File without changes
|
{lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/tests/test_lambda_function.py
RENAMED
|
File without changes
|
|
File without changes
|
{lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/tests/test_packaging_current.py
RENAMED
|
File without changes
|
|
File without changes
|
{lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/tests/test_public_api.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/tests/test_resource_graph.py
RENAMED
|
File without changes
|
|
File without changes
|
{lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/tests/test_rest_builder.py
RENAMED
|
File without changes
|
{lambda_api_decorators_cdk-0.4.6 → lambda_api_decorators_cdk-0.4.7}/tests/test_source_layout.py
RENAMED
|
File without changes
|