棱镜生成:要合并的字段配置具有重复的字段名称

时间:2018-12-08 16:01:15

标签: graphql prisma generate prisma-graphql

我在此输出中出现了

正在运行 prisma generate ,并且没有代码生成。

http {
    upstream api  {
      server api:5434;
    }

    upstream app {
      server app:3000;
    }

    # Server for https
    server {
      listen       443 ssl http2;
      server_name  mobydq.net;

      ssl_certificate      /etc/letsencrypt/live/mobydq.net/fullchain.pem;
      ssl_certificate_key  /etc/letsencrypt/live/mobydq.net/privkey.pem;

      # Location for MobyDQ Flask API
      location /mobydq {
        limit_req zone=default burst=20;
        proxy_pass http://api;
        proxy_redirect   off;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
      }

      # Location for MobyDQ Web App
      location / {
        limit_req zone=default burst=20;
        proxy_pass http://app;
        proxy_redirect   off;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
      }
    }

    # Default server to redirect http requests to https
    server {
      listen 80 default_server;
      server_name mobydq.net;
      listen [::]:80 default_server;

        location ~ /.well-known {
            root /var/www/letsencrypt;
        }
        location / {
            return 301 https://$host$request_uri;
        }
    }
}

我的架构出了什么问题?

prisma generate
Generating schema...
[ { species: { type: [Object], args: [Object] } },
  { species: { type: [Object], args: [Object] },
Generating schema !
 !    Field configuration to merge has duplicate field names.

1 个答案:

答案 0 :(得分:4)

Prisma根据您的数据模型生成GraphQL模式。这样做,它会根据您的类型生成复数类型

但是,由于Species的复数为Species,因此Prisma现在具有两种具有相同名称的类型,因此会引发错误。 (请参见与News相同的issue

您目前无法为类型或字段选择复数名称(请参见issue)。

通常,只为您的类型使用单个名称是一个很好的建议。