Is there some situation under which deleteType is not generated?

Hey All,

I’m using the following schema

type Metric {
  name: String! @id
  readings: [Reading!]
}

type Collection {
  timestamp: DateTime! @search
  readings: [Reading!]!
}

type Reading {
  value: Float
  metric: Metric! @hasInverse(field: readings)
  collection: Collection! @hasInverse(field: readings)
}

It my mutations, I see the following functions:

addMetric(input: [AddMetricInput!]!): AddMetricPayload
updateMetric(input: UpdateMetricInput!): UpdateMetricPayload
deleteMetric(filter: MetricFilter!): DeleteMetricPayload
addCollection(input: [AddCollectionInput!]!): AddCollectionPayload
updateCollection(input: UpdateCollectionInput!): UpdateCollectionPayload
deleteCollection(filter: CollectionFilter!): DeleteCollectionPayload
addReading(input: [AddReadingInput!]!): AddReadingPayload

Notice, the absence updateReading or deleteReading function. Any idea why this is happening? I thought this might be because of the hasInverse functions, but even after I remove them, this doesn’t seem to work

Tejas

That is simply because there is no way to identify a Reading.

For Metric there is a field with @id, so you could identify a Metric that way.

For Collection, there is a field with @search, so you could filter some Collection using that.

But, for Reading there is no ID, @id or @search field, so no way to identify a Reading. Hence, no TypeFilter can be generated for it. Resulting in no update and delete mutations.

1 Like