public static String dataToAvroSchemaJson(DataSchema dataSchema)
  {
    return dataToAvroSchemaJson(dataSchema, new DataToAvroSchemaTranslationOptions());
  }
@Test(dataProvider = "pegasusDefaultToAvroOptionalSchemaTranslationProvider",
        description = "Test schemaTranslator for default fields to optional fields translation, in different schema translation modes")
  public void testPegasusDefaultToAvroOptionalSchemaTranslation(String... testSchemaTextAndExpected) throws IOException
  {

    String schemaText = null;
    String expectedAvroSchema = null;
    DataMap resultAvroDataMap = null;
    DataMap expectedAvroDataMap = null;
    schemaText = testSchemaTextAndExpected[0];
    expectedAvroSchema = testSchemaTextAndExpected[1];
    List<String> schemaTextForTesting = null;

    if (schemaText.contains("##T_START")) {
      String noTyperefSchemaText = schemaText.replace("##T_START", "").replace("##T_END", "");
      String typerefSchemaText = schemaText
          .replace("##T_START", "{ \"type\" : \"typeref\", \"name\" : \"Ref\", \"ref\" : ")
          .replace("##T_END", "}");
      schemaTextForTesting = Arrays.asList(noTyperefSchemaText, typerefSchemaText);
    }
    else {
      schemaTextForTesting = Arrays.asList(schemaText);
    }

    for (String schemaStringText: schemaTextForTesting) {
      DataSchema schema = TestUtil.dataSchemaFromString(schemaStringText);
      String avroTextFromSchema = null;
      avroTextFromSchema = SchemaTranslator.dataToAvroSchemaJson(
          schema,
          new DataToAvroSchemaTranslationOptions(PegasusToAvroDefaultFieldTranslationMode.DO_NOT_TRANSLATE)
      );
      resultAvroDataMap = TestUtil.dataMapFromString(avroTextFromSchema);
      expectedAvroDataMap = TestUtil.dataMapFromString(expectedAvroSchema);
      assertEquals(resultAvroDataMap, expectedAvroDataMap);

      // Test avro Schema
      Schema avroSchema = AvroCompatibilityHelper.parse(avroTextFromSchema);

      // Test validation parsing
      SchemaParser parser = new SchemaParser();
      ValidationOptions options = new ValidationOptions();
      options.setAvroUnionMode(true);
      parser.setValidationOptions(options);
      parser.parse(avroTextFromSchema);
      assertFalse(parser.hasError(), parser.errorMessage());
    }
  }