Skip to content

Commit 7141b40

Browse files
author
Ana Falcao
committed
changed parser documentation
1 parent 9d5acc1 commit 7141b40

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

docs/utilities/parser.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ The Parser utility in Powertools for AWS Lambda simplifies data parsing and vali
2121

2222
Powertools for AWS Lambda (Python) supports Pydantic v2. Each Pydantic version requires different dependencies before you can use Parser.
2323

24+
```python
25+
pip install aws-lambda-powertools
26+
```
27+
2428
!!! info "This is not necessary if you're installing Powertools for AWS Lambda (Python) via [Lambda Layer/SAR](../index.md#lambda-layer){target="\_blank"}"
2529

2630
???+ warning
@@ -31,9 +35,7 @@ Powertools for AWS Lambda (Python) supports Pydantic v2. Each Pydantic version r
3135

3236
Pip example:`SKIP_CYTHON=1 pip install --no-binary pydantic aws-lambda-powertools[parser]`
3337
34-
```python
35-
pip install aws-lambda-powertools
36-
```
38+
3739

3840
You can also add as a dependency in your preferred tool: e.g., requirements.txt, pyproject.toml.
3941

@@ -370,7 +372,7 @@ You can use the following test event:
370372
### Data model validation
371373

372374
???+ warning
373-
This is radically different from the **Validator utility** which validates events against JSON Schema.
375+
This is radically different from the **Validator utility** which validates events against JSON Schema.
374376

375377
You can use Pydantic's validator for deep inspection of object values and complex relationships.
376378

@@ -419,7 +421,6 @@ def lambda_handler(event: dict, context: LambdaContext):
419421
If you run using a test event `{"message": "hello universe"}` you should expect the following error with the message we provided in our exception:
420422

421423
```python
422-
message
423424
Message must be hello world! (type=value_error)
424425
```
425426

@@ -500,7 +501,7 @@ def lambda_handler(event: dict, context: LambdaContext):
500501
- The keyword argument `mode='after'` will cause the validator to be called after all field-level validation and parsing has been completed.
501502

502503
???+ info
503-
You can read more about validating list items, reusing validators, validating raw inputs, and a lot more in [Pydantic's documentation](`https://pydantic-docs.helpmanual.io/usage/validators/`).
504+
You can read more about validating list items, reusing validators, validating raw inputs, and a lot more in [Pydantic's documentation](`https://pydantic-docs.helpmanual.io/usage/validators/`).
504505

505506
**String fields that contain JSON data**
506507

@@ -644,7 +645,7 @@ def lambda_handler(event: dict, context: LambdaContext) -> dict:
644645
```
645646

646647
???+ info
647-
There are number of advanced use cases well documented in Pydantic's doc such as creating [immutable models](https://pydantic-docs.helpmanual.io/usage/models/#faux-immutability){target="\_blank" rel="nofollow"}, [declaring fields with dynamic values](https://pydantic-docs.helpmanual.io/usage/models/#field-with-dynamic-default-value){target="\_blank" rel="nofollow"}.
648+
There are number of advanced use cases well documented in Pydantic's doc such as creating [immutable models](https://pydantic-docs.helpmanual.io/usage/models/#faux-immutability){target="\_blank" rel="nofollow"}, [declaring fields with dynamic values](https://pydantic-docs.helpmanual.io/usage/models/#field-with-dynamic-default-value){target="\_blank" rel="nofollow"}.
648649

649650
## FAQ
650651

0 commit comments

Comments
 (0)