CrossClj

0.7.0 docs

SourceDocs



RECENT
    VARS
    *encode?*
    *transformer*
    +invalid+
    +problems+
    ->Spec
    coerce-spec
    conform
    conform!
    create-spec
    decode
    deserialize
    encode
    explain
    explain-data
    extra-spec-map
    fail-on-extra-keys-transformer
    fail-on-invoke
    get-spec
    into-spec
    json-transformer
    map->Spec
    map-spec-keys
    merge
    merge-impl
    no-op-transformer
    registry
    select-spec
    serialize
    spec
    spec-description
    spec-name
    spec?
    string-transformer
    strip-extra-keys-transformer
    Transformer
    type-transformer

    « Index of all namespaces of this project

    PrivateDynamic
    (->Spec spec form type)
    Positional factory function for class spec_tools.core.Spec.
    
    (coerce-spec name-or-spec)
    Returns a spec from a spec name or spec. Throwns exception
    if no spec was found.
    (conform spec value)(conform spec value transformer)
    Given a spec and a value, returns the possibly destructured value
    or ::s/invalid
    (conform! spec value)(conform! spec value transformer)
    Given a spec and a value, returns the possibly destructured value
    or fails with ex-info with :type of ::conform. ex-data also contains
    :problems, :spec and :value. call s/unform on the result to get the
    actual conformed value.
    (create-spec {:keys [spec type form], :as m})
    Creates a Spec intance from a map containing the following keys:
    
           :spec  the wrapped spec predicate (mandatory)
           :form  source code of the spec predicate, if :spec is a spec,
                  :form is read with s/form out of it. For non-spec
                  preds, spec-tools.forms/resolve-form is called, if still
                  not available, spec-creation will fail.
           :type  optional type for the spec. if not set, will be auto-
                  resolved via spec-tools.forms/resolve-type (optional)
         :reason  reason to be added to problems with s/explain (optional)
            :gen  generator function for the spec (optional)
           :name  name of the spec (optional)
    :description  description of the spec (optional)
          :xx/yy  any qualified keys can be added (optional)
    (decode spec value)(decode spec value transformer)
    Transforms and validates a value (using a [[Transformer]]) from external
    format into a value defined by the spec. On error, returns ::s/invalid.
    (deserialize s)
    Reads specs from a string.
    TODO: Should optionally read the realated Registry entries.
    (encode spec value transformer)
    Transforms a valid value (using a [[Transformer]]) from external
    format into a value defined by the spec. Allows values to be
    transformed into illegal ones.
    (explain spec value)(explain spec value transformer)
    (explain-data spec value)(explain-data spec value transformer)
    Private
    (extra-spec-map t)
    Private
    (fail-on-invoke spec)
    (get-spec name)
    Finds recursively a spec implementation from the registry
    
    (map->Spec m__7585__auto__)
    Factory function for class spec_tools.core.Spec, taking a map of keywords to field values.
    
    Private
    (map-spec-keys spec)
    macro
    (merge & forms)
    (merge-impl forms spec-form merge-spec)
    (registry)(registry re)
    (select-spec spec value)
    Drops all extra keys out of a Keys spec value. To use this recursively,
    wrap all child Keys Specs into Spec Records. See CLJ-2116 for details.
    (serialize spec)
    Writes specs into a string that can be read by the reader.
    TODO: Should optionally write the realated Registry entries.
    macro
    (spec pred-or-info)(spec pred info)
    Creates a Spec instance with one or two arguments:
    
    ;; using type inference
    (spec integer?)
    
    ;; with explicit type
    (spec integer? {:type :long})
    
    ;; map form
    (spec {:spec integer?, :type :long})
    
    calls create-spec, see it for details.
    (spec-description spec)
    Returns a spec description.
    
    (spec-name spec)
    Returns a spec name. Like the private clojure.spec.alpha/spec-name
    
    protocol
    (-decoder this spec value)
    (-encoder this spec value)
    (-name this)
    (type-transformer {transformer-name :name, :keys [encoders decoders default-encoder default-decoder]})