api-foundry 0.8.1__tar.gz → 0.8.2__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.
- {api_foundry-0.8.1 → api_foundry-0.8.2}/PKG-INFO +1 -1
- {api_foundry-0.8.1 → api_foundry-0.8.2}/api_foundry/utils/model_factory.py +60 -0
- {api_foundry-0.8.1 → api_foundry-0.8.2}/pyproject.toml +1 -1
- {api_foundry-0.8.1 → api_foundry-0.8.2}/.gitignore +0 -0
- {api_foundry-0.8.1 → api_foundry-0.8.2}/LICENSE +0 -0
- {api_foundry-0.8.1 → api_foundry-0.8.2}/api_foundry/__init__.py +0 -0
- {api_foundry-0.8.1 → api_foundry-0.8.2}/api_foundry/iac/gateway_spec.py +0 -0
- {api_foundry-0.8.1 → api_foundry-0.8.2}/api_foundry/iac/pulumi/api_foundry.py +0 -0
- {api_foundry-0.8.1 → api_foundry-0.8.2}/api_foundry/scripts/install_secret.py +0 -0
- {api_foundry-0.8.1 → api_foundry-0.8.2}/api_foundry/scripts/postgres_to_openapi.py +0 -0
- {api_foundry-0.8.1 → api_foundry-0.8.2}/api_foundry/utils/app_exception.py +0 -0
- {api_foundry-0.8.1 → api_foundry-0.8.2}/api_foundry/utils/logger.py +0 -0
- {api_foundry-0.8.1 → api_foundry-0.8.2}/api_foundry/utils/schema_validator.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: api-foundry
|
|
3
|
-
Version: 0.8.
|
|
3
|
+
Version: 0.8.2
|
|
4
4
|
Summary: The `api_foundry` project is a powerful tool designed to automate the deployment of REST APIs on AWS using Lambda services to access and interact with relational databases (RDBMS). This project leverages the OpenAPI specification to define and manage the APIs
|
|
5
5
|
Project-URL: Documentation, https://github.com/DanRepik/api-foundry
|
|
6
6
|
Project-URL: Source, https://github.com/DanRepik/api-foundry
|
|
@@ -124,6 +124,9 @@ class SchemaObjectProperty(OpenAPIElement):
|
|
|
124
124
|
self.key_type = None
|
|
125
125
|
self.sequence_name = None
|
|
126
126
|
self.concurrency_control = self._concurrency_control(schema_name, prop)
|
|
127
|
+
# Value injection attributes
|
|
128
|
+
self.inject_value = prop.get("x-af-inject-value", None)
|
|
129
|
+
self.inject_on = self._parse_inject_on(name, prop) or None
|
|
127
130
|
# For embedded objects/arrays
|
|
128
131
|
self.sub_properties: Optional[Dict[str, SchemaObjectProperty]] = None
|
|
129
132
|
self.items_sub_properties: Optional[Dict[str, SchemaObjectProperty]] = None
|
|
@@ -143,6 +146,47 @@ class SchemaObjectProperty(OpenAPIElement):
|
|
|
143
146
|
)
|
|
144
147
|
return concurrency_control
|
|
145
148
|
|
|
149
|
+
def _parse_inject_on(self, property_name: str, prop_dict: dict) -> list[str]:
|
|
150
|
+
"""
|
|
151
|
+
Parse x-af-inject-on attribute or infer default behavior based on
|
|
152
|
+
property name and x-af-inject-value presence.
|
|
153
|
+
"""
|
|
154
|
+
inject_value = prop_dict.get("x-af-inject-value")
|
|
155
|
+
if not inject_value:
|
|
156
|
+
return []
|
|
157
|
+
|
|
158
|
+
# Explicit configuration takes precedence
|
|
159
|
+
if "x-af-inject-on" in prop_dict:
|
|
160
|
+
inject_on = prop_dict["x-af-inject-on"]
|
|
161
|
+
if isinstance(inject_on, list):
|
|
162
|
+
return inject_on
|
|
163
|
+
return [inject_on]
|
|
164
|
+
|
|
165
|
+
# Infer from property name patterns
|
|
166
|
+
# Properties starting with "created" default to create-only
|
|
167
|
+
if property_name.startswith("created_"):
|
|
168
|
+
return ["create"]
|
|
169
|
+
|
|
170
|
+
# Properties starting with "updated" default to update-only
|
|
171
|
+
if property_name.startswith("updated_"):
|
|
172
|
+
return ["update"]
|
|
173
|
+
|
|
174
|
+
# Properties ending with "_by" or "_at" default to create-only
|
|
175
|
+
if property_name.endswith(("_by", "_at")):
|
|
176
|
+
return ["create"]
|
|
177
|
+
|
|
178
|
+
# Tenant/owner fields default to create-only (immutable)
|
|
179
|
+
if property_name in [
|
|
180
|
+
"tenant_id",
|
|
181
|
+
"owner_id",
|
|
182
|
+
"organization_id",
|
|
183
|
+
"workspace_id",
|
|
184
|
+
]:
|
|
185
|
+
return ["create"]
|
|
186
|
+
|
|
187
|
+
# Default: inject only on create for safety
|
|
188
|
+
return ["create"]
|
|
189
|
+
|
|
146
190
|
|
|
147
191
|
class SchemaObjectKey(SchemaObjectProperty):
|
|
148
192
|
"""Represents a primary key in a schema object."""
|
|
@@ -206,6 +250,7 @@ class SchemaObject(OpenAPIElement):
|
|
|
206
250
|
self.relations = self._resolve_relations(schema_object)
|
|
207
251
|
self.concurrency_property = self._get_concurrency_property(schema_object)
|
|
208
252
|
self.permissions = self._get_permissions(schema_object)
|
|
253
|
+
self.inject_properties = self._get_inject_properties()
|
|
209
254
|
|
|
210
255
|
def _get_table_name(self, schema_object: dict) -> str:
|
|
211
256
|
schema = schema_object.get("x-af-schema")
|
|
@@ -380,6 +425,21 @@ class SchemaObject(OpenAPIElement):
|
|
|
380
425
|
validate_permissions(normalized)
|
|
381
426
|
return normalized or {}
|
|
382
427
|
|
|
428
|
+
def _get_inject_properties(self) -> dict:
|
|
429
|
+
"""
|
|
430
|
+
Collect all properties that have injection attributes.
|
|
431
|
+
|
|
432
|
+
Returns a dictionary mapping property names to their injection metadata.
|
|
433
|
+
"""
|
|
434
|
+
inject_props = {}
|
|
435
|
+
for prop_name, prop in self.properties.items():
|
|
436
|
+
if hasattr(prop, "inject_value") and prop.inject_value:
|
|
437
|
+
inject_props[prop_name] = {
|
|
438
|
+
"inject_value": prop.inject_value,
|
|
439
|
+
"inject_on": getattr(prop, "inject_on", ["create"]),
|
|
440
|
+
}
|
|
441
|
+
return inject_props
|
|
442
|
+
|
|
383
443
|
def to_dict(self) -> Dict[str, Any]:
|
|
384
444
|
"""Recursively convert this schema object and its properties."""
|
|
385
445
|
data = super().to_dict()
|
|
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
|