From 9a66b6ea12261b9f28cf245ee9b7c93d39f0ff26 Mon Sep 17 00:00:00 2001 From: Michael Brewer Date: Thu, 8 Apr 2021 19:09:59 -0700 Subject: [PATCH 1/3] docs: Correct links and line highlights Changes: - Use target _blank for external links - Correct some of the line highlighted in the examples - Fix links to Tracer --- docs/core/event_handler/appsync.md | 6 +++--- docs/utilities/middleware_factory.md | 8 ++++---- docs/utilities/validation.md | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/core/event_handler/appsync.md b/docs/core/event_handler/appsync.md index 00881e4e868..3f61a4ad311 100644 --- a/docs/core/event_handler/appsync.md +++ b/docs/core/event_handler/appsync.md @@ -32,7 +32,7 @@ This is the sample infrastructure we are using for the initial examples with a A === "schema.graphql" !!! tip "Designing GraphQL Schemas for the first time?" - Visit [AWS AppSync schema documentation](https://docs.aws.amazon.com/appsync/latest/devguide/designing-your-schema.html) for understanding how to define types, nesting, and pagination. + Visit [AWS AppSync schema documentation](https://docs.aws.amazon.com/appsync/latest/devguide/designing-your-schema.html){target="_blank"} for understanding how to define types, nesting, and pagination. ```typescript --8<-- "docs/shared/getting_started_schema.graphql" @@ -183,7 +183,7 @@ Here's an example where we have two separate functions to resolve `getTodo` and === "app.py" - ```python hl_lines="3-4 8 30-31 38-39 46" + ```python hl_lines="3-5 9 31-32 39-40 47" from aws_lambda_powertools import Logger, Tracer from aws_lambda_powertools.logging import correlation_paths @@ -428,7 +428,7 @@ Assuming you have [Amplify CLI installed](https://docs.amplify.aws/cli/start/ins === "schema.graphql" - ```typescript hl_lines="8 10 18 23 25" + ```typescript hl_lines="7 15 20 22" @model type Merchant { id: String! diff --git a/docs/utilities/middleware_factory.md b/docs/utilities/middleware_factory.md index cfa6406abfc..953088ab9b0 100644 --- a/docs/utilities/middleware_factory.md +++ b/docs/utilities/middleware_factory.md @@ -60,7 +60,7 @@ You can also have your own keyword arguments after the mandatory arguments. ## Tracing middleware execution -If you are making use of [Tracer](../core/tracer.md), you can trace the execution of your middleware to ease operations. +If you are making use of [Tracer](/core/tracer), you can trace the execution of your middleware to ease operations. This makes use of an existing Tracer instance that you may have initialized anywhere in your code. @@ -78,9 +78,9 @@ This makes use of an existing Tracer instance that you may have initialized anyw ... ``` -When executed, your middleware name will [appear in AWS X-Ray Trace details as](../core/tracer) `## middleware_name`. +When executed, your middleware name will [appear in AWS X-Ray Trace details as](/core/tracer) `## middleware_name`. -For advanced use cases, you can instantiate [Tracer](../core/tracer) inside your middleware, and add annotations as well as metadata for additional operational insights. +For advanced use cases, you can instantiate [Tracer](/core/tracer) inside your middleware, and add annotations as well as metadata for additional operational insights. === "app.py" @@ -100,7 +100,7 @@ For advanced use cases, you can instantiate [Tracer](../core/tracer) inside your * Use `trace_execution` to quickly understand the performance impact of your middlewares, and reduce or merge tasks when necessary * When nesting multiple middlewares, always return the handler with event and context, or response -* Keep in mind [Python decorators execution order](https://realpython.com/primer-on-python-decorators/#nesting-decorators). Lambda handler is actually called once (top-down) +* Keep in mind [Python decorators execution order](https://realpython.com/primer-on-python-decorators/#nesting-decorators){target="_blank"}. Lambda handler is actually called once (top-down) * Async middlewares are not supported ## Testing your code diff --git a/docs/utilities/validation.md b/docs/utilities/validation.md index 72e90127222..3a32500f122 100644 --- a/docs/utilities/validation.md +++ b/docs/utilities/validation.md @@ -20,7 +20,7 @@ You can validate inbound and outbound events using [`validator` decorator](#vali You can also use the standalone `validate` function, if you want more control over the validation process such as handling a validation error. -We support any JSONSchema draft supported by [fastjsonschema](https://horejsek.github.io/python-fastjsonschema/) library. +We support any JSONSchema draft supported by [fastjsonschema](https://horejsek.github.io/python-fastjsonschema/){target="_blank"} library. !!! warning Both `validator` decorator and `validate` standalone function expects your JSON Schema to be a **dictionary**, not a filename. @@ -184,7 +184,7 @@ Envelope name | JMESPath expression ### Validating custom formats !!! note "New in 1.10.0" - JSON Schema DRAFT 7 [has many new built-in formats](https://json-schema.org/understanding-json-schema/reference/string.html#format) such as date, time, and specifically a regex format which might be a better replacement for a custom format, if you do have control over the schema. + JSON Schema DRAFT 7 [has many new built-in formats](https://json-schema.org/understanding-json-schema/reference/string.html#format){target="_blank"} such as date, time, and specifically a regex format which might be a better replacement for a custom format, if you do have control over the schema. JSON Schemas with custom formats like `int64` will fail validation. If you have these, you can pass them using `formats` parameter: @@ -528,7 +528,7 @@ This sample will decompress and decode base64 data, then use JMESPath pipeline e This will **replace all provided built-in functions such as `powertools_json`, so you will no longer be able to use them**. -For special binary formats that you want to decode before applying JSON Schema validation, you can bring your own [JMESPath function](https://github.com/jmespath/jmespath.py#custom-functions) and any additional option via `jmespath_options` param. +For special binary formats that you want to decode before applying JSON Schema validation, you can bring your own [JMESPath function](https://github.com/jmespath/jmespath.py#custom-functions){target="_blank"} and any additional option via `jmespath_options` param. === "custom_jmespath_function.py" From a02c9868ad97ba501ce47b3b62316834aa438d59 Mon Sep 17 00:00:00 2001 From: Michael Brewer Date: Fri, 9 Apr 2021 00:13:28 -0700 Subject: [PATCH 2/3] docs: Correct internal links to tracer --- docs/utilities/middleware_factory.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/utilities/middleware_factory.md b/docs/utilities/middleware_factory.md index 953088ab9b0..b0f5d4a1ccd 100644 --- a/docs/utilities/middleware_factory.md +++ b/docs/utilities/middleware_factory.md @@ -60,7 +60,7 @@ You can also have your own keyword arguments after the mandatory arguments. ## Tracing middleware execution -If you are making use of [Tracer](/core/tracer), you can trace the execution of your middleware to ease operations. +If you are making use of [Tracer](../core/tracer.md), you can trace the execution of your middleware to ease operations. This makes use of an existing Tracer instance that you may have initialized anywhere in your code. @@ -78,9 +78,9 @@ This makes use of an existing Tracer instance that you may have initialized anyw ... ``` -When executed, your middleware name will [appear in AWS X-Ray Trace details as](/core/tracer) `## middleware_name`. +When executed, your middleware name will [appear in AWS X-Ray Trace details as](../core/tracer.md) `## middleware_name`. -For advanced use cases, you can instantiate [Tracer](/core/tracer) inside your middleware, and add annotations as well as metadata for additional operational insights. +For advanced use cases, you can instantiate [Tracer](../core/tracer.md) inside your middleware, and add annotations as well as metadata for additional operational insights. === "app.py" From 7fdff56eda6784cbcb3499696077954d92cb278a Mon Sep 17 00:00:00 2001 From: Michael Brewer Date: Fri, 9 Apr 2021 00:18:35 -0700 Subject: [PATCH 3/3] docs: Include .md in internal links --- docs/index.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/index.md b/docs/index.md index 2e8a46cc3b8..f7baba3b7dc 100644 --- a/docs/index.md +++ b/docs/index.md @@ -141,18 +141,18 @@ aws serverlessrepo list-application-versions \ | Utility | Description | ------------------------------------------------- | --------------------------------------------------------------------------------- -| [Tracing](./core/tracer) | Decorators and utilities to trace Lambda function handlers, and both synchronous and asynchronous functions -| [Logger](./core/logger) | Structured logging made easier, and decorator to enrich structured logging with key Lambda context details -| [Metrics](./core/metrics) | Custom Metrics created asynchronously via CloudWatch Embedded Metric Format (EMF) +| [Tracing](./core/tracer.md) | Decorators and utilities to trace Lambda function handlers, and both synchronous and asynchronous functions +| [Logger](./core/logger.md) | Structured logging made easier, and decorator to enrich structured logging with key Lambda context details +| [Metrics](./core/metrics.md) | Custom Metrics created asynchronously via CloudWatch Embedded Metric Format (EMF) | [Event handler](./core/event_handler) | Event handler decorators for common Lambda events -| [Middleware factory](./utilities/middleware_factory) | Decorator factory to create your own middleware to run logic before, and after each Lambda invocation -| [Parameters](./utilities/parameters) | Retrieve parameter values from AWS Systems Manager Parameter Store, AWS Secrets Manager, or Amazon DynamoDB, and cache them for a specific amount of time -| [Batch processing](./utilities/batch) | Handle partial failures for AWS SQS batch processing -| [Typing](./utilities/typing) | Static typing classes to speedup development in your IDE -| [Validation](./utilities/validation) | JSON Schema validator for inbound events and responses -| [Event source data classes](./utilities/data_classes) | Data classes describing the schema of common Lambda event triggers -| [Parser](./utilities/parser) | Data parsing and deep validation using Pydantic -| [Idempotency](./utilities/idempotency) | Idempotent Lambda handler +| [Middleware factory](./utilities/middleware_factory.md) | Decorator factory to create your own middleware to run logic before, and after each Lambda invocation +| [Parameters](./utilities/parameters.md) | Retrieve parameter values from AWS Systems Manager Parameter Store, AWS Secrets Manager, or Amazon DynamoDB, and cache them for a specific amount of time +| [Batch processing](./utilities/batch.md) | Handle partial failures for AWS SQS batch processing +| [Typing](./utilities/typing.md) | Static typing classes to speedup development in your IDE +| [Validation](./utilities/validation.md) | JSON Schema validator for inbound events and responses +| [Event source data classes](./utilities/data_classes.md) | Data classes describing the schema of common Lambda event triggers +| [Parser](./utilities/parser.md) | Data parsing and deep validation using Pydantic +| [Idempotency](./utilities/idempotency.md) | Idempotent Lambda handler ## Environment variables