Liking cljdoc? Tell your friends :D

json-schema.infer


eradicate-listsclj

(eradicate-lists m)
source

inferclj

(infer params & docs)

Schema inference from multiple documents of associative data. Takes n sample documents as input, and returns a schema that allows only data represented in at least one of the documents.

Data that is present in all documents will be required. Data only represented in a subset of documents will be optional. Data not represented at all, will not be allowed.

If a single document is passed, infer-strict is used directly.

Multiple documents can be passed either via apply: (apply (partial infer params) vector-of-inputs

Or if you have a (lazy) seq of things, infer directly: (infer params lazy-inputs) Example: (infer {:additional-props false :nullable true} (map slurp list-of-filenames))

Params: title - schema title description - schema description uri - schema uri schema - continue building on schema optional - keys that shouldn't be required additional-props - don't allow props not in schema nullable - optionality by nullability

Schema inference from multiple documents of associative data.
Takes n sample documents as input, and returns a schema that allows only
data represented in at least one of the documents.

Data that is present in all documents will be required.
Data only represented in a subset of documents will be optional.
Data not represented at all, will not be allowed.

If a single document is passed, infer-strict is used directly.

Multiple documents can be passed either via apply:
(apply (partial infer params) vector-of-inputs

Or if you have a (lazy) seq of things, infer directly:
(infer params lazy-inputs)
Example:
(infer {:additional-props false
        :nullable true}
       (map slurp list-of-filenames))

Params:
  title            - schema title
  description      - schema description
  uri              - schema uri
  schema           - continue building on schema
  optional         - keys that shouldn't be required
  additional-props - don't allow props not in schema
  nullable         - optionality by nullability
sourceraw docstring

infer->jsonclj

(infer->json params data)

A helper function that returns inferred schema as JSON

A helper function that returns inferred schema as JSON
sourceraw docstring

infer-strictclj

(infer-strict {:keys [title schema optional additional-props] :as params} data)

Naive but strict schema inference from associative data. Strict in the sense that everything is required, and nothing else is allowed - unless additional-props is explicitly set to true.

Params: optional - keys that shouldn't be required additional-props - if additional properties are allowed in schema objects

Optional params: title - schema title description - schema description uri - schema uri schema - continue building on schema

Naive but strict schema inference from associative data.
Strict in the sense that everything is required, and nothing
else is allowed - unless additional-props is explicitly set to true.

Params:
  optional         - keys that shouldn't be required
  additional-props - if additional properties are allowed in schema objects

Optional params:
  title       - schema title
  description - schema description
  uri         - schema uri
  schema      - continue building on schema
sourceraw docstring

key-pathsclj

(key-paths m)

Returns a sequence of all key paths in a given map using DFS walk. Converts lists to vectors to enable associative lookup.

Based on code from: https://dnaeon.github.io/clojure-map-ks-paths/

Returns a sequence of all key paths in a given map using DFS walk.
Converts lists to vectors to enable associative lookup.

Based on code from:
https://dnaeon.github.io/clojure-map-ks-paths/
sourceraw docstring

sanitize-keyclj

(sanitize-key k)
source

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close