Skip to content

Commit

Permalink
Follow REFs in the schema
Browse files Browse the repository at this point in the history
  • Loading branch information
kddejong committed Oct 12, 2024
1 parent 7bc6d07 commit 5869027
Show file tree
Hide file tree
Showing 135 changed files with 72 additions and 1,521 deletions.
12 changes: 10 additions & 2 deletions scripts/boto/_automated_patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,15 @@ def _per_resource_patch(
continue
if p_name.lower() == member.lower():

path = f"/properties/{p_name}"

if "$ref" in p_data:
pointer = p_data["$ref"].split("/")
p_data = schema_data.get(pointer[1], {}).get(pointer[2], {})
if not p_data:
continue
path = f"/{'/'.join(pointer[1:])}"

# skip if we already have an enum or pattern
if any([p_data.get(field) for field in _fields]):
continue
Expand All @@ -125,7 +134,7 @@ def _per_resource_patch(
if not any([member_shape.get(field) for field in _fields]):
continue

results[f"/properties/{p_name}"] = Patch(
results[path] = Patch(
source=source,
shape=member_shape_name,
)
Expand Down Expand Up @@ -177,7 +186,6 @@ def each_boto_service(boto_path: Path, schema_path: Path) -> AllPatches:
boto_path = boto_path / "botocore-master" / "botocore" / "data"

for service_dir in boto_path.iterdir():
print(service_dir)
if not service_dir.is_dir():
continue

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
{
"op": "add",
"path": "/properties/PackagingType/enum",
"path": "/definitions/PackagingType/enum",
"value": [
"APPSTREAM2",
"CUSTOM"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
{
"op": "add",
"path": "/properties/Platform/enum",
"path": "/definitions/PlatformType/enum",
"value": [
"WINDOWS_SERVER_2019"
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
{
"op": "add",
"path": "/properties/AppBlockArn/pattern",
"path": "/definitions/Arn/pattern",
"value": "^arn:aws(?:\\-cn|\\-iso\\-b|\\-iso|\\-us\\-gov)?:[A-Za-z0-9][A-Za-z0-9_/.-]{0,62}:[A-Za-z0-9_/.-]{0,63}:[A-Za-z0-9_/.-]{0,63}:[A-Za-z0-9][A-Za-z0-9:_/+=,@.\\\\-]{0,1023}$"
}
]
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
[
{
"op": "add",
"path": "/properties/Name/pattern",
"value": "^[^\\\\]*$"
},
{
"op": "add",
"path": "/properties/Description/pattern",
"path": "/definitions/AssessmentDescription/pattern",
"value": "^[\\w\\W\\s\\S]*$"
},
{
"op": "add",
"path": "/properties/FrameworkId/pattern",
"value": "^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$"
}
]

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
"path": "/properties/Name/pattern",
"value": "^(?! )[\\p{L}\\p{N}\\p{Z}-_]*(?<! )$"
},
{
"op": "add",
"path": "/properties/EffectiveStart/pattern",
"value": "^\\d{4}-\\d\\d-\\d\\dT\\d\\d:\\d\\d:\\d\\d(([+-]\\d\\d:\\d\\d)|Z)$"
},
{
"op": "add",
"path": "/properties/DefaultValue/pattern",
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
[
{
"op": "add",
"path": "/properties/MembershipIdentifier/pattern",
"value": "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}"
},
{
"op": "add",
"path": "/properties/KmsKeyArn/pattern",
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
[
{
"op": "add",
"path": "/properties/VolumeKmsKeyId/pattern",
"value": "^\\p{ASCII}+$"
},
{
"op": "add",
"path": "/properties/ModelKmsKeyId/pattern",
"path": "/definitions/KmsKeyId/pattern",
"value": "^\\p{ASCII}+$"
}
]

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,20 +1,7 @@
[
{
"op": "add",
"path": "/properties/SourceIp/pattern",
"path": "/definitions/IpAddress/pattern",
"value": "^([0-9]{1,3}.){3}[0-9]{1,3}$"
},
{
"op": "add",
"path": "/properties/DestinationIp/pattern",
"value": "^([0-9]{1,3}.){3}[0-9]{1,3}$"
},
{
"op": "add",
"path": "/properties/Protocol/enum",
"value": [
"tcp",
"udp"
]
}
]
Loading

0 comments on commit 5869027

Please sign in to comment.