Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable specifying list type in computed fields #277

Open
lucperkins opened this issue Jul 29, 2022 · 2 comments
Open

Enable specifying list type in computed fields #277

lucperkins opened this issue Jul 29, 2022 · 2 comments

Comments

@lucperkins
Copy link

lucperkins commented Jul 29, 2022

As far as I can tell, it isn't possible to specify the of type of lists in computed fields the way that you can in non-computed fields. Thus, this is possible:

fields: {
  tags: {
    type: "list",
    of: { type: "string" },
    default: []
  }  
}

But this is not:

computedFields: {
  segments: {
    type: "list",
    of: { type: "string" },
    resolve: (doc) => { ... }
  }
}

Instead, you can only specify an untyped list, and in the generated output you end up with this:

segments: list

But this raw list type isn't defined!

There may be reasons to explicitly disallow typed lists in computed fields, and if so I'd be curious why! Otherwise, this feels like an oversight to me.

@schickling
Copy link
Collaborator

I agree there are definitely some gaps in regards to which types can be used for computed fields. This will be addressed before 1.0 is released. (Also see #149)

@lucperkins
Copy link
Author

@schickling Sounds great. I look forward to it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants