Skip to content

Commit

Permalink
Update generation code for the specific case of geojson (#463)
Browse files Browse the repository at this point in the history
* Update generation code for the specific case of geojson

* Update changelog

* Fix type to match maplibre-gl

* Remove unwanted console.log

* Fix lint

* Update CHANGELOG.md

Co-authored-by: Bart Louwers <bart.louwers@gmail.com>

---------

Co-authored-by: Bart Louwers <bart.louwers@gmail.com>
  • Loading branch information
HarelM and louwers authored Jan 1, 2024
1 parent ee2ffd9 commit ca5dd4e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
## main

### ✨ Features and improvements

* Add back `migrate`, `validate` and `format` to the exported methods of this package
* Add terrain to diff method and improve type. This also removes the `operations` from the API [#460](https://github.com/maplibre/maplibre-style-spec/pull/460)
* Improve the type of `data` in the `GeoJSONSourceSpecification` for TypeScript.

## 19.3.3

### ✨ Features and improvements

* Improve types for feature to include `unknown` [#365](https://github.com/maplibre/maplibre-style-spec/pull/365)
* Improve sprite documentation and supported versions [#390](https://github.com/maplibre/maplibre-style-spec/pull/390)


## 19.3.2

### ✨ Features and improvements

* Add raster dem source `redFactor`, `greenFactor`, `blueFactor`, `baseShift` properties [#326](https://github.com/maplibre/maplibre-style-spec/issues/326)
* Improve error messages around `hillshade` layers not using `raster-dem` sources [#353](https://github.com/maplibre/maplibre-style-spec/pull/353)

## 19.3.1

### ✨ Features and improvements

* Document `raster-fade-duration` property's effect on rendering a video. [#297](https://github.com/maplibre/maplibre-style-spec/pull/297)
* Add and expose `isZoomExpression`. [#267](https://github.com/maplibre/maplibre-style-spec/issues/267)

Expand Down
9 changes: 8 additions & 1 deletion build/generate-style-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,14 @@ ${objectDeclaration('LightSpecification', spec.light)}
${objectDeclaration('TerrainSpecification', spec.terrain)}
${spec.source.map(key => objectDeclaration(sourceTypeName(key), spec[key])).join('\n\n')}
${spec.source.map(key => {
let str = objectDeclaration(sourceTypeName(key), spec[key]);
if (sourceTypeName(key) === 'GeoJSONSourceSpecification') {
// This is done in order to overcome the type system's inability to express this type:
str = str.replace(/unknown/, 'GeoJSON.GeoJSON | string');
}
return str;
}).join('\n\n')}
export type SourceSpecification =
${spec.source.map(key => ` | ${sourceTypeName(key)}`).join('\n')}
Expand Down

0 comments on commit ca5dd4e

Please sign in to comment.