void doSyntaxCheck(NamespaceTextModel model) {
    if (StringUtils.isBlank(model.getConfigText())) {
      return;
    }

    // only support yaml syntax check
    if (model.getFormat() != ConfigFileFormat.YAML && model.getFormat() != ConfigFileFormat.YML) {
      return;
    }

    // use YamlPropertiesFactoryBean to check the yaml syntax
    TypeLimitedYamlPropertiesFactoryBean yamlPropertiesFactoryBean = new TypeLimitedYamlPropertiesFactoryBean();
    yamlPropertiesFactoryBean.setResources(new ByteArrayResource(model.getConfigText().getBytes()));
    try {
      // this call converts yaml to properties and will throw exception if the conversion fails
      yamlPropertiesFactoryBean.getObject();
    }catch (Exception ex){
      throw new BadRequestException(ex.getMessage());
    }
  }
@Test
  public void yamlSyntaxCheckOK() throws Exception {
    String yaml = loadYaml("case1.yaml");

    itemController.doSyntaxCheck(assemble(ConfigFileFormat.YAML.getValue(), yaml));
  }