How to use the @mapbox/mapbox-gl-style-spec.validate function in @mapbox/mapbox-gl-style-spec

To help you get started, we’ve selected a few @mapbox/mapbox-gl-style-spec 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 maputnik / editor / src / components / App.jsx View on Github external
onStyleChanged = (newStyle, save=true) => {

    const errors = validate(newStyle, latest)
    if(errors.length === 0) {

      if(newStyle.glyphs !== this.state.mapStyle.glyphs) {
        this.updateFonts(newStyle.glyphs)
      }
      if(newStyle.sprite !== this.state.mapStyle.sprite) {
        this.updateIcons(newStyle.sprite)
      }

      this.revisionStore.addRevision(newStyle)
      if(save) this.saveStyle(newStyle)
      this.setState({
        mapStyle: newStyle,
        errors: [],
      })
    } else {
github maputnik / editor / src / components / App.jsx View on Github external
onStyleChanged = (newStyle, save=true) => {

    const errors = validate(newStyle, latest)
    if(errors.length === 0) {

      if(newStyle.glyphs !== this.state.mapStyle.glyphs) {
        this.updateFonts(newStyle.glyphs)
      }
      if(newStyle.sprite !== this.state.mapStyle.sprite) {
        this.updateIcons(newStyle.sprite)
      }

      this.revisionStore.addRevision(newStyle)
      if(save) this.saveStyle(newStyle)
      this.setState({
        mapStyle: style.replaceAccessTokens(newStyle, {allowFallback: true}),
      })
      this.fetchSources()
      this.setState({