Class JsonSchemaResolver

java.lang.Object
org.apache.camel.component.jackson.transform.JsonSchemaResolver
All Implemented Interfaces:
SchemaResolver, org.apache.camel.Processor

public class JsonSchemaResolver extends Object implements SchemaResolver, org.apache.camel.Processor
Schema resolver able to read Json schema from given exchange being processed. First attempt is to retrieve the Json schema reference from exchange properties. Second approach is to convert a given Json schema given as String in the exchange properties to a proper schema object. Last approach it to load the Json schema as a classpath resource. The following resource path is used to resolve the schema classpath:schemas/json/<T>.json where T represents the content class name of the exchange body. The content class information is either set as an explicit exchange property or it gets resolved from exchange body type information.
  • Constructor Details

    • JsonSchemaResolver

      public JsonSchemaResolver()
  • Method Details

    • getSchema

      public String getSchema()
    • setSchema

      public void setSchema(String schema)
    • getContentClass

      public String getContentClass()
    • setContentClass

      public void setContentClass(String contentClass)
    • process

      public void process(org.apache.camel.Exchange exchange) throws Exception
      Specified by:
      process in interface org.apache.camel.Processor
      Throws:
      Exception
    • resolve

      public com.fasterxml.jackson.core.FormatSchema resolve(org.apache.camel.Exchange exchange)
      Description copied from interface: SchemaResolver
      Resolves a schema for the given exchange.
      Specified by:
      resolve in interface SchemaResolver
      Parameters:
      exchange - the exchange for which the schema should be resolved
      Returns:
      the resolved format or null if no format is found