Utils

Utils.getPaginationMeta(options)Object
static
Parameters:
  • options
    • Type: Object
      • limit
        • Type: Integer
      • offset
        • Type: Integer
      • count
        • Type: Integer
Returns: Object
Example:
require('serviser').utils.getPaginationMeta(options)
//Although you probably want to use res.setPaginationHeaders(options) method
// which sets all response headers needed for pagination
Utils.registerCustomKeywords(ajv)Ajv
static

adds $desc & $toJSON schema keywords to Ajv validator

Parameters:
  • ajv
    • Type: Ajv
    • validator instance

Returns: Ajv
Example:
require('serviser').utils.registerCustomKeywords(ajv)
Utils.resolveSchemaRefs(val, validator, _root)Object
static

dereferences releative $refs and internal references to other ajv validator schemas

Parameters:
  • val
    • Type: Object or Array
    • value

  • validator
    • Type: Ajv
  • _root optional
    • Type: Object or Array
    • initial value

Returns: Object
comments powered by Disqus