为什么initial-data.yml不允许映射电子邮件的值?

时间:2012-02-18 23:44:59

标签: java playframework yaml

我正在构建一个intial-data.yml文件来测试我的游戏!应用程序,但是当我尝试加载页面时,我在读取intial-data.yml文件时收到错误。它似乎能够解析用户名,名字和姓氏字段,但当它到达电子邮件时,它会吐出以下错误:

play.exceptions.YAMLException: null; mapping values are not allowed here (in file /conf/initial-data.yml line 7, column 11)
    at play.test.Fixtures.loadModels(Fixtures.java:234)
    at Bootstrap.doJob(Bootstrap.java:12)
    at play.jobs.Job.doJobWithResult(Job.java:50)
    at play.jobs.Job.call(Job.java:146)
    at Invocation.Job(Play!)
Caused by: mapping values are not allowed here
 in "<reader>", line 7, column 11:
         email:     myemail@gmail.com
              ^

我的YML文件中的第一个条目如下所示:

# Test data

User(Dan):
    username:   Username1
    fname:      John
    lname:      Doe
     email:     myemail@gmail.com
     password:     password1

有谁知道为什么会这样?

1 个答案:

答案 0 :(得分:6)

如果对齐列,则工作正常(emailpassword在示例中有额外的1个空格缩进):

# Test data

User(Dan):
    username:   Username1
    fname:      John
    lname:      Doe
    email:     myemail@gmail.com
    password:     password1

这个online parser对调试很有用......