Skip to content

Compose spec #51

Description

@arichiardi

One of the great features of clojure.spec is the ability of merging specs, because they are essentially data (ok macros are still in the way, but nothing is perfect).

At the moment js.spec does not do that, but it would be great if we could do something like:

const aSpec = S.spec.map("a spec", {
  a: S.spec.object,
  b: S.spec.object,
});

const composedSpec = S.merge(aSpec , {
  c: S.spec.object
}

Ok the example does not make too much sense, but we should be composing and reusing specs.

...I have had a look at the code and this is actually a big shift because of the use of class...still think is worth doing it...maybe the S.merge function can just merge the fields...

Activity

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

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