Skip to content

:spec/extend does not interact with :cardinality #10

Open
@DavidGregory084

Description

I have a schema that uses ISO2 country codes in various places, and in one of those places a list of countries is defined.

^{:type String :cardinality [1 n]
  :optional true
  :spec/extend :purely.receivables.generators/iso-2code?
  :spec/gen :purely.receivables.generators/iso-2code} countries

Unfortunately, when :spec/extend is used with :cardinality, this causes problems.

Exception: java.lang.IllegalArgumentException: Wrong number of args passed to keyword: :purely.receivables.generators/iso-2code                                                                                                  

It seems like it would be straightforward to change the interpretation of :spec/extends so that the provided generator would be used within the coll-of generator rather than outside it, but this might prevent other users from writing specs that check the properties of whole sequences rather than just their elements.

Do you have any thoughts about the best way to solve this?

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions