Skip to content

feature: Support views #152

Description

@theCalcaholic

✨ Describe the feature you'd like

Currently, entrest breaks for views (ent.View), because it tries to generate the full range of CRUD operations, resulting in errors like ent/rest/create.go: undefined: ent.MyViewCreate.

Would be very nice and probably a low hanging fruit if entrest only generated readonly operations for Views.

This would tremendously extend the flexibility of the generated APIs. For example it would allow to:

  • Model separate privacy policies for different fields of the same table (by excluding one in a view and not the other)
  • Exposing metadata about fields/edges on an endpoint without exposing the actual data (e.g. returning the count of users instead of the user data)
  • and so on

🌧 Is your feature request related to a problem?

No response

🔎 Describe alternatives you've considered

I tried annotating the type with entrest.WithIncludeOperations(entrest.OperationRead, entrest.OperationList), however that doesn't help either (presumably, because it only disables the handlers/mounting the handler fns, not the underlying code).

⚠ If implemented, do you think this feature will be a breaking change to users?

No

⚙ Additional context

No response

🤝 Requirements

  • I have confirmed that someone else has not submitted a similar feature request.
  • If implemented, I believe this feature will help others, in addition to solving my problems.
  • I have looked into alternative solutions to the best of my ability.
  • (optional) I would be willing to contribute to testing this feature if implemented, or making a PR to implement this functionality.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions