Skip to content

<Collection>QueryOperations type is missing few fields #64

Description

@schardev

Given a collection like this:

const Pages: CollectionConfig = {
  slug: 'pages',
  fields: [
    { type: 'text', label: 'Name', name: 'name' },
    { type: 'textarea', label: 'Description', name: 'description' },
    {
      type: 'row',
      fields: [
        {
          type: 'text',
          name: 'about',
          label: 'About',
        },
      ],
    },
  ],
};

The generated types for Page collection are (stripped for brevity):

  • Page schema
"Page": {
  "type": "object",
  "title": "Page",
  "properties": {
    "id": { "type": "string" },
    "name": { "type": ["string", "null"] },
    "description": { "type": ["string", "null"] },
    "about": { "type": ["string", "null"] },
    "updatedAt": { "type": "string" },
    "createdAt": { "type": "string" }
  },
  "required": ["id", "updatedAt", "createdAt"]
}
  • PageQueryOperations schema
"PageQueryOperations": {
  "title": "Page query operations",
  "type": "object",
  "properties": {
    "name": {
      "type": "object",
      "properties": {
        "equals": { "type": "string" },
        "not_equals": { "type": "string" },
        "in": { "type": "string" },
        "not_in": { "type": "string" },
        "like": { "type": "string" },
        "contains": { "type": "string" }
      }
    },
    "updatedAt": { "type": "object", "properties": { /* ... */ } },
    "createdAt": { "type": "object", "properties": { /* ... */ } }
  }
}

Notice how about (the field inside the row) shows up fine in the main Page schema, but it’s completely missing from PageQueryOperations.

Same with textarea fields, they don’t show up in query ops either, though that one looks like an easy fix.

(There are probably few more field types that are missing, like tabs for example.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions