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

When creating schemas, generate defaults #12

Merged
merged 2 commits into from
Nov 8, 2024
Merged

When creating schemas, generate defaults #12

merged 2 commits into from
Nov 8, 2024

Conversation

leo
Copy link
Member

@leo leo commented Nov 8, 2024

This change ensures that, when a new schema is created, all of its settings are auto-generated.

@leo leo added the enhancement New feature or request label Nov 8, 2024
@leo leo requested a review from colodenn November 8, 2024 09:47
Copy link

linear bot commented Nov 8, 2024

RON-1083 Improve query compiler further before release

Now that RON-1049 has landed, I am placing my personal list of future improvements for the query transformer on Linear, to prevent it from getting lost as I will begin working on the output transformer.

We have to tackle those improvements before launching the transformer publicly.

  • Ensure that the root export does not allow for passing options. This is currently only the case because the package invokes itself in the case of sub queries. We should have a separate function to accomplish that.
  • Evaluate improved foreign key actions
  • Rename excluding to something that makes it clear that it now acts like SELECT in SQL.
  • Rename to to something that works for both create and set. Previously, create used with, which doesn't make sense, since with allows for asserting fields. to is more accurate since that only allows for providing values. Alternatively, add another instruction that is only used by create, which would also allow us to land RON-503, because set does not need support for arrays at the root level.
  • Consider making group fields use underscores instead of periods, as discussed on Slack.
  • Make sure that "dropping all records of a schema" does not cause a type error.
  • Consider allowing a query to be used as the default value of a field.
  • Consider only requiring slug for schemas, not pluralSlug. Potentially pluralSlug should become the default and be called slug, and then singularSlug could exist for the singular case. Either way, since they are auto-generated, developers should not worry about them in most cases — only if they want to.
  • Consider spreading the error tests in errors.test.ts over the query instruction test files, because meta.test.ts also asserts errors already.
  • Set up a linting rule to avoid duplicate test names, because Bun doesn't seem to complain about this natively, which means we can't know whether we have duplicated test names without checking the whole list of 85 tests manually or with a script for each one.
  • Make including: 'all' work again, but first figure out the syntax. In prod, we support including: 'all', but perhaps we should instead allow globs or a regex so that a list of fields can be matched easily? That could also be used in excluding.
  • Revise all errors one more time to ensure they are consistent.

Open Questions

  • How can people overwrite entire JSON structures? Since, currently, providing an object for a JSON field in a query will perform a json_patch update.
  • Should the default meta field for createdBy and updatedBy be removed, since the accounts are stored in the database of the RONIN space, which is an entirely different database? Perhaps we could handle this by displaying the most recent change event of a record on the dashboard instead, or rather the author of that event.
  • Should we allow for overwriting the createdAt and updatedAt metadata fields?
  • Do we even need zod for validating queries if the transformer already has to validate a lot of things that zod can't do? It almost seems as if the transformer is zod.

Copy link

github-actions bot commented Nov 8, 2024

Released an experimental package:

bun add @ronin/compiler@leo-ron-1083-experimental

This package will be removed after the pull request has been merged.

@leo leo marked this pull request as ready for review November 8, 2024 10:12
@leo leo enabled auto-merge (squash) November 8, 2024 10:12
@leo leo merged commit e47d305 into main Nov 8, 2024
3 checks passed
@leo leo deleted the leo/ron-1083 branch November 8, 2024 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants