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

WIP: Generalize properties to constraints #1025

Draft
wants to merge 238 commits into
base: master
Choose a base branch
from

Conversation

frenchy64
Copy link
Contributor

@frenchy64 frenchy64 commented Mar 27, 2024

Merge first: #1029

In prototyping phase. Overall goal is to obviate the need for :and, :not, and :fn schemas, in particular because of their brittle generators. It also leads more more relevant error messages #1001.

TODO

  • validate
  • explain
  • generate
  • transform
  • parse
  • merge/union

Ideas:

  • (Noah) allow :or property [:map {:or [:a :b :c]} ..]
  • rename :keys to :keyset
  • enhance :set with the same properties for heterogeneous sets
  • enhance :map-of with keyset constraints
  • generalize beyond keysets, just call them "constraints".
  • rename :keyset to :and.
  • integer constraints [:int {:> 5 :< 10}], easier to generate than [:and :int [:> 5] [:< 10]].
  • make :min :max constraints so they can participate in constraint resolution
  • extend to :double
  • take :gen/min :gen/max into account earlier during solution generation
  • perhaps :gen/and :gen/or etc?
  • :string constraints
  • extend humanize output to structure logical operators explicitly ("should either a or b" => [:or "should a" "should b"])
  • :dispatch constraint
[:multi {:dispatch :db/valueType}
 [:db.type/tuple [:map {:xor [:db/tupleType :db/tupleAttrs :db/tupleTypes]}
                  [:db/tupleType {:optional true} ...]
                  [:db/tupleAttrs {:optional true} ...]
                  [:db/tupleTypes {:optional true} ...]]]]
==>
[:map {:dispatch [:db/valueType
                  [:db.type/tuple [:xor :db/tupleType :db/tupleAttrs :db/tupleTypes]]]
                  [:db.type/string ...]
                  [:db.type/ref ...]}
 [:db/tupleType {:optional true} ...]
 [:db/tupleAttrs {:optional true} ...]
 [:db/tupleTypes {:optional true} ...]]

@frenchy64 frenchy64 changed the title WIP: Support keyset constraints in :map via :keys property WIP: Support keyset constraints in :map via :keyset property Mar 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant