Search in sources :

Example 1 with JsonTypeLoader

use of org.mule.metadata.json.api.JsonTypeLoader in project mule by mulesoft.

the class CustomStaticTypeDeclarationEnricher method getJsonType.

private Optional<MetadataType> getJsonType(String schema) {
    String schemaContent = IOUtils.toString(getSchemaContent(schema));
    Optional<MetadataType> type = new JsonTypeLoader(schemaContent).load(null);
    if (!type.isPresent()) {
        throw new IllegalArgumentException("Could not load type from Json schema [" + schema + "]");
    }
    return type;
}
Also used : MetadataType(org.mule.metadata.api.model.MetadataType) JsonTypeLoader(org.mule.metadata.json.api.JsonTypeLoader)

Aggregations

MetadataType (org.mule.metadata.api.model.MetadataType)1 JsonTypeLoader (org.mule.metadata.json.api.JsonTypeLoader)1