How to use the @sanity/schema/lib/sanity/groupProblems function in @sanity/schema

To help you get started, we’ve selected a few @sanity/schema examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sanity-io / sanity / packages / @sanity / base / src / schema / createSchema.js View on Github external
module.exports = schemaDef => {
  const validated = validateSchema(schemaDef.types).getTypes()

  const validation = groupProblems(validated)
  const hasErrors = validation.some(group => group.problems.some(isError))

  let types = []
  if (!hasErrors) {
    types = [
      ...schemaDef.types,
      assetSourceData,
      slug,
      geopoint,
      legacyRichDate,
      imageAsset,
      fileAsset,
      imageCrop,
      imageHotspot,
      imageMetadata,
      imageDimensions,

@sanity/schema

- **`Schema`** A collection of types - **`Type`** A specification of a data structure. Available through schema lookup. - **`Member type`** A member type is a type contained by a schema type. For example, an array may specify the allowed item types by def

MIT
Latest version published 12 hours ago

Package Health Score

92 / 100
Full package analysis