Prisma generate: конфигурация поля для объединения имеет повторяющиеся имена полей

Запуск prisma generate я попал в этот вывод и код не генерируется.

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

Что не так с моей схемой?

type User {
  id: ID! @unique
  email: String! @unique
  name: String!
  password: String!
  entries: [Entry!]!
  createdAt: DateTime!
  updatedAt: DateTime!
}

type Language {
  id: ID! @unique
  language: String! @unique
  createdAt: DateTime!
  updatedAt: DateTime!
}

type EntryScientificName {
  id: ID! @unique
  entry: Entry!
  isMain: Boolean!
  scientificName: String! @unique
  language: Language!
  createdAt: DateTime!
  updatedAt: DateTime!
}

type EntryName {
  id: ID! @unique
  entry: Entry!
  isMain: Boolean!
  name: String! @unique
  Language: Language!
  createdAt: DateTime!
  updatedAt: DateTime!
}

type Species {
  id: ID! @unique
  species: String! @unique
  description: String
  createdAt: DateTime!
  updatedAt: DateTime!
}

type Genus {
  id: ID! @unique
  genus: String! @unique
  description: String
  createdAt: DateTime!
  updatedAt: DateTime!
}

type Family {
  id: ID! @unique
  family: String! @unique
  description: String
  createdAt: DateTime!
  updatedAt: DateTime!
}

type Order {
  id: ID! @unique
  order: String! @unique
  description: String
  createdAt: DateTime!
  updatedAt: DateTime!
}

type Habitat {
  id: ID! @unique
  habitat: String! @unique
  description: String
  createdAt: DateTime!
  updatedAt: DateTime!
}

type Month {
  id: ID! @unique
  month: String! @unique
}

type Anthesis {
  id: ID! @unique
  entry: Entry
  fromMonth: Month! @relation(name: "FromMonth")
  toMonth: Month! @relation(name: "ToMonth")
  note: String
  createdAt: DateTime!
  updatedAt: DateTime!
}

type Nation {
  id: ID! @unique
  nation: String! @unique
  createdAt: DateTime!
  updatedAt: DateTime!
}

type Region {
  id: ID! @unique
  nation: Nation!
  region: String! @unique
  createdAt: DateTime!
  updatedAt: DateTime!
}

type DistributionDetail {
  id: ID! @unique
  detail: String!
  createdAt: DateTime!
  updatedAt: DateTime!
}

type GeographicDistribution {
  id: ID! @unique
  entry: Entry!
  region: Region!
  detail: DistributionDetail
  createdAt: DateTime!
  updatedAt: DateTime!
}

type Altitude {
  id: ID! @unique
  entry: Entry! @unique
  altitudeFrom: Int! @unique @constraint(min: -10894, max: 408000)
  altitudeTo: Int! @unique @constraint(min: -10894, max: 408000)
}

type Entry {
  id: ID! @unique
  name: [EntryName!]!
  scientificName: [EntryScientificName!]!
  species: Species
  genus: Genus
  family: Family
  order: Order
  biologicalForm: String
  plantDescription: String
  leafDescription: String
  flowerDescription: String
  fruitDescriptio: String
  chorologicalType: String
  habitat: [Habitat!]!
  geographicDistribution: [GeographicDistribution!]!
  altitude: [Altitude!]!
  etymology: String
  propertiesUses: String
  curiosities: String
  notes: String
  links: [Link!]!
  entryPicture: String
  draft: Boolean @default(value: "true")
  published: Boolean @default(value: "false")
  toBeReviewed: Boolean @default(value: "false")
  createdAt: DateTime!
  updatedAt: DateTime!
  author: User
}

type Link {
  id: ID! @unique
  createdAt: DateTime!
  updatedAt: DateTime!
  url: String!
  description: String!
  postedby: User
}

1 ответ

Решение

Prisma генерирует схему GraphQL на основе вашей модели данных. При этом он генерирует множественные типы в зависимости от ваших типов.

Однако, потому что множественное число Species является SpeciesPrisma теперь имеет два типа с одинаковыми именами, поэтому выдает ошибку. (Смотрите ту же проблему с News)

В настоящее время вы не можете выбрать множественное имя для типа или поля (см. Выпуск).

Как правило, это хороший совет, чтобы у вас были только единичные имена.

Другие вопросы по тегам