Functions and the macros that work with global clojure.spec registry to generate the specomatic schema.
Functions and the macros that work with global clojure.spec registry to generate the specomatic schema.
(defent etype & args)
Defines an entity. Takes the same arguments as s/keys and
The entity name is added as a namespace to any unqualified keywords. If no spec exists for a field, but there is one for a keyword in the current namespace (overridden by :ns) and with the same name as the field, it is used for the field.
Defines an entity. Takes the same arguments as s/keys and * :id to specify the id field for the entity (optional, default is :entity-type/id) * :field-ns for a namespace to use field specs from (optional, default is current namespace) The entity name is added as a namespace to any unqualified keywords. If no spec exists for a field, but there is one for a keyword in the current namespace (overridden by :ns) and with the same name as the field, it is used for the field.
(dispatch spec)
Given spec spec
, returns the spec if it is a keyword, or a description thereof if it is not.
Given spec `spec`, returns the spec if it is a keyword, or a description thereof if it is not.
Returns the fields from an entity-defining spec form, preserving the order of the fields.
Returns the fields from an entity-defining spec form, preserving the order of the fields.
Returns the required fields from an entity-defining spec form as a set
Returns the required fields from an entity-defining spec form as a set
Checks if this spec form defines an entity type, extensible to every spec predicate function.
Checks if this spec form defines an entity type, extensible to every spec predicate function.
(field-def spec)
Given spec spec
, returns a map containing information about the spec:
{:kind one of #{:simple :reference :reference-coll :part-coll}
:dispatch the spec if it is a keyword or a description thereof if it is not. Used for dispatch
:target the target entity type, only defined if type is #{:reference :reference-coll :part-coll}
Given spec `spec`, returns a map containing information about the spec: {:kind one of #{:simple :reference :reference-coll :part-coll} :dispatch the spec if it is a keyword or a description thereof if it is not. Used for dispatch :target the target entity type, only defined if type is #{:reference :reference-coll :part-coll}
(full-schema namespaces)
(full-schema namespaces override)
(full-schema namespaces override only)
Returns the entity schema for the namespaces
as a map of entities to their schema.
Optionally restricted to a sequence of entities only
.
Specific entity and field definitions may by overridden by an override
map in the same shape as the schema.
Shape of result:
{::my.namespace.entity {:field-defs map of fields to fields' specs
:id-field id field for the entity
:required-fields set of required fields}
::my.namespace.entity2 ... }
Returns the entity schema for the `namespaces` as a map of entities to their schema. Optionally restricted to a sequence of entities `only`. Specific entity and field definitions may by overridden by an `override` map in the same shape as the schema. Shape of result: {::my.namespace.entity {:field-defs map of fields to fields' specs :id-field id field for the entity :required-fields set of required fields} ::my.namespace.entity2 ... }
Returns the referenced entity type from the given reference spec collection form, extensible to every spec predicate function.
Returns the referenced entity type from the given reference spec collection form, extensible to every spec predicate function.
Checks if this spec form defines a collection of references. Extensible to every spec predicate function.
Checks if this spec form defines a collection of references. Extensible to every spec predicate function.
Checks if the key refers to the entity part of a s/or reference spec.
Checks if the key refers to the entity part of a s/or reference spec.
Checks if the key refers to the id part of a s/or reference spec.
Checks if the key refers to the id part of a s/or reference spec.
Returns the referenced entity type from the given reference spec form, extensible to every spec predicate function.
Returns the referenced entity type from the given reference spec form, extensible to every spec predicate function.
Checks if this spec form defines a reference. Extensible to every spec predicate function.
Checks if this spec form defines a reference. Extensible to every spec predicate function.
(schema namespaces)
(schema namespaces only)
Returns the entity schema for the namespaces
as a map of entities to their schema.
Optionally restricted to a sequence of entities only
.
Shape of result:
{::my.namespace.entity {:field-defs map of fields to fields' specs
:id-field id field for the entity
:required-fields set of required fields}
::my.namespace.entity2 ... }
Returns the entity schema for the `namespaces` as a map of entities to their schema. Optionally restricted to a sequence of entities `only`. Shape of result: {::my.namespace.entity {:field-defs map of fields to fields' specs :id-field id field for the entity :required-fields set of required fields} ::my.namespace.entity2 ... }
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close