Class LambdaSchemaValidator

java.lang.Object
com.networknt.aws.lambda.LambdaSchemaValidator

public class LambdaSchemaValidator extends Object
It is called in the Lambda framework to validate the request against the openapi.yaml specification. Each function will have the openapi.yaml packaged as configuration and this class will use it to validate the request headers, query parameters, path parameters and body based on the json schema. The validateRequest is called by the request-handler that intercepts the request and response in the App.
Author:
Steve Hu, Gavin Chen
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static com.networknt.openapi.ValidatorConfig
     
    static com.networknt.openapi.OpenApiHelper
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static String
    getBasePath(String requestPath)
     
    com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent
    validateRequest(com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent requestEvent)
    Validate the request based on the openapi.yaml specification

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • config

      public static com.networknt.openapi.ValidatorConfig config
    • helper

      public static com.networknt.openapi.OpenApiHelper helper
  • Constructor Details

    • LambdaSchemaValidator

      public LambdaSchemaValidator()
  • Method Details

    • validateRequest

      public com.amazonaws.services.lambda.runtime.events.APIGatewayProxyResponseEvent validateRequest(com.amazonaws.services.lambda.runtime.events.APIGatewayProxyRequestEvent requestEvent)
      Validate the request based on the openapi.yaml specification
      Parameters:
      requestEvent - request event
      Returns:
      responseEvent if error and null if pass.
    • getBasePath

      public static String getBasePath(String requestPath)