Skip to content

Commit a457e5f

Browse files
Adding documentation
1 parent 6442d59 commit a457e5f

File tree

4 files changed

+20
-16
lines changed

4 files changed

+20
-16
lines changed

aws_lambda_powertools/utilities/validation/base.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ def validate_data_against_schema(
3434
Returns
3535
-------
3636
Dict
37-
The validated event. If the schema includes a `default` for fields that are not provided, they will be included
38-
in the response.
37+
The validated event. If the schema specifies a `default` value for fields that are omitted,
38+
those default values will be included in the response.
3939
4040
Raises
4141
------

aws_lambda_powertools/utilities/validation/validator.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,8 @@ def handler(event, context):
248248
Returns
249249
-------
250250
Dict
251-
The validated event. If the schema includes a `default` for fields that are not provided, they will be included
252-
in the response.
251+
The validated event. If the schema specifies a `default` value for fields that are omitted,
252+
those default values will be included in the response.
253253
254254
Raises
255255
------

docs/utilities/validation.md

+4
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ It will fail fast with `SchemaValidationError` exception if event or response do
6767

6868
**Validate** standalone function is typically used within the Lambda handler, or any other methods that perform data validation.
6969

70+
???+ info
71+
This function returns the validated event as a JSON object. If the schema specifies `default` values for omitted fields,
72+
those default values will be included in the response.
73+
7074
You can also gracefully handle schema validation errors by catching `SchemaValidationError` exception.
7175

7276
=== "getting_started_validator_standalone_function.py"

tests/functional/validator/conftest.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
@pytest.fixture
77
def schema():
88
return {
9-
"$schema": "http://json-schema.org/draft-07/schema",
10-
"$id": "http://example.com/example.json",
9+
"$schema": "https://json-schema.org/draft-07/schema",
10+
"$id": "https://example.com/example.json",
1111
"type": "object",
1212
"title": "Sample schema",
1313
"description": "The root schema comprises the entire JSON document.",
@@ -33,8 +33,8 @@ def schema():
3333
@pytest.fixture
3434
def schema_default():
3535
return {
36-
"$schema": "http://json-schema.org/draft-07/schema",
37-
"$id": "http://example.com/example.json",
36+
"$schema": "https://json-schema.org/draft-07/schema",
37+
"$id": "https://example.com/example.json",
3838
"type": "object",
3939
"title": "Sample schema",
4040
"description": "The root schema comprises the entire JSON document.",
@@ -61,8 +61,8 @@ def schema_default():
6161
@pytest.fixture
6262
def schema_array():
6363
return {
64-
"$schema": "http://json-schema.org/draft-07/schema",
65-
"$id": "http://example.com/example.json",
64+
"$schema": "https://json-schema.org/draft-07/schema",
65+
"$id": "https://example.com/example.json",
6666
"type": "array",
6767
"title": "Sample schema",
6868
"description": "Sample JSON Schema for dummy data in an array",
@@ -99,8 +99,8 @@ def schema_array():
9999
@pytest.fixture
100100
def schema_response():
101101
return {
102-
"$schema": "http://json-schema.org/draft-07/schema",
103-
"$id": "http://example.com/example.json",
102+
"$schema": "https://json-schema.org/draft-07/schema",
103+
"$id": "https://example.com/example.json",
104104
"type": "object",
105105
"title": "Sample outgoing schema",
106106
"description": "The root schema comprises the entire JSON document.",
@@ -117,7 +117,7 @@ def schema_response():
117117
def schema_refs():
118118
return {
119119
"ParentSchema": {
120-
"$schema": "http://json-schema.org/draft-07/schema",
120+
"$schema": "https://json-schema.org/draft-07/schema",
121121
"$id": "testschema://ParentSchema",
122122
"type": "object",
123123
"title": "Sample schema",
@@ -132,7 +132,7 @@ def schema_refs():
132132
},
133133
},
134134
"ChildSchema": {
135-
"$schema": "http://json-schema.org/draft-07/schema",
135+
"$schema": "https://json-schema.org/draft-07/schema",
136136
"$id": "testschema://ChildSchema",
137137
"type": "object",
138138
"title": "Sample schema",
@@ -440,7 +440,7 @@ def cloudwatch_logs_event():
440440
@pytest.fixture
441441
def cloudwatch_logs_schema():
442442
return {
443-
"$schema": "http://json-schema.org/draft-07/schema",
443+
"$schema": "https://json-schema.org/draft-07/schema",
444444
"$id": "http://example.com/example.json",
445445
"type": "array",
446446
"title": "Sample schema",
@@ -655,7 +655,7 @@ def eventbridge_schema_registry_cloudtrail_v2_s3():
655655
@pytest.fixture
656656
def schema_datetime_format():
657657
return {
658-
"$schema": "http://json-schema.org/draft-07/schema",
658+
"$schema": "https://json-schema.org/draft-07/schema",
659659
"$id": "http://example.com/example.json",
660660
"type": "object",
661661
"title": "Sample schema with string date-time format",

0 commit comments

Comments
 (0)