static void parseAndValidateExtensionSchemas(String resolverPath, File inputDir)
     throws IOException, InvalidExtensionSchemaException
 {
   // Parse each extension schema and validate it
   Iterator<File> iterator = FileUtils.iterateFiles(inputDir, new String[]{PDL}, true);
   DataSchemaResolver resolver = MultiFormatDataSchemaResolver.withBuiltinFormats(resolverPath);
   while (iterator.hasNext())
   {
     File inputFile = iterator.next();
     PdlSchemaParser parser = new PdlSchemaParser(resolver);
     parser.parse(new FileInputStream(inputFile));
     if (parser.hasError())
     {
       throw new InvalidExtensionSchemaException(parser.errorMessage());
     }

     List<DataSchema> topLevelDataSchemas = parser.topLevelDataSchemas();
     if (topLevelDataSchemas == null || topLevelDataSchemas.isEmpty() || topLevelDataSchemas.size() > 1)
     {
       throw new InvalidExtensionSchemaException("Could not parse extension schema : " + inputFile.getAbsolutePath());
     }

     // Validate that the schema is a named schema
     DataSchema topLevelDataSchema = topLevelDataSchemas.get(0);
     if (!(topLevelDataSchema instanceof NamedDataSchema))
     {
       throw new InvalidExtensionSchemaException("Invalid extension schema : " + inputFile.getAbsolutePath() + ", the schema is not a named schema.");
     }

     // Validate that the schema has the proper suffix in its name
     if (!((NamedDataSchema) topLevelDataSchema).getName().endsWith(EXTENSIONS_SUFFIX))
     {
       throw new InvalidExtensionSchemaException(
           "Invalid extension schema name: '" + ((NamedDataSchema) topLevelDataSchema).getName() + "'. The name of the extension schema must be <baseSchemaName> + 'Extensions'");
     }

     // Validate that the schema includes exactly one base schema
     List<NamedDataSchema> includes = ((RecordDataSchema) topLevelDataSchema).getInclude();
     if (includes.size() != 1)
     {
       throw new InvalidExtensionSchemaException("The extension schema: '" + ((NamedDataSchema) topLevelDataSchema).getName() + "' should include and only include the base schema");
     }

     // Validate that the schema's name is suffixed with the name of the base schema
     NamedDataSchema includeSchema = includes.get(0);
     if (!((NamedDataSchema) topLevelDataSchema).getName().startsWith(includeSchema.getName()))
     {
       throw new InvalidExtensionSchemaException(
           "Invalid extension schema name: '" + ((NamedDataSchema) topLevelDataSchema).getName() + "'. The name of the extension schema must be baseSchemaName: '"
               + includeSchema.getName() + "' + 'Extensions");
     }

      List<RecordDataSchema.Field> extensionSchemaFields = ((RecordDataSchema) topLevelDataSchema).getFields()
          .stream()
          .filter(f -> !((RecordDataSchema) topLevelDataSchema).isFieldFromIncludes(f))
          .collect(Collectors.toList());

      // Validate all the extension fields
      checkExtensionSchemaFields(extensionSchemaFields);
    }
  }
@Test(dataProvider = "extensionSchemaInputFiles")
  public void testExtensionSchemaValidation(String inputDir, boolean isValid, String errorMessage)
  {
      String resolverPath = testPegasusDir;
      String inputPath = testExtensionDir + File.separator + inputDir;

      SoftAssert softAssert = new SoftAssert();
      try
      {
        ExtensionSchemaValidationCmdLineApp.parseAndValidateExtensionSchemas(resolverPath, new File(inputPath));
        softAssert.assertTrue(isValid);
        softAssert.assertEquals(null, errorMessage);
      }
      catch (Exception e)
      {
        softAssert.assertTrue(!isValid);
        softAssert.assertEquals(e.getMessage(), errorMessage);
      }
      softAssert.assertAll();
  }