Skip to content

Commit c4962d4

Browse files
committed
type
1 parent fab238b commit c4962d4

File tree

5 files changed

+11
-13
lines changed

5 files changed

+11
-13
lines changed

build/generate-docs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ function typeToMarkdownLink(type: string): string {
166166
case 'promoteid':
167167
return ` [${type}](types.md)`;
168168
case 'color':
169-
case 'projection-mode':
169+
case 'projectiontype':
170170
case 'number':
171171
case 'string':
172172
case 'boolean':

docs/types.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,8 @@ The following example applies 2em padding on top and bottom and 3em padding left
138138

139139
There are currently two projection types implemented.
140140

141-
- `mercator` - A web mercator projection
142-
- `globe` - A spherical projection
141+
- `mercator` - Web Mercator projection
142+
- `globe` - Globe projection
143143

144144

145145
**Use a single projection**

src/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ function validSchema(k, v, obj, ref, version, kind) {
7070
'padding',
7171
'variableAnchorOffsetCollection',
7272
'sprite',
73-
'projection-mode'
73+
'projectionType'
7474
]);
7575
const keys = [
7676
'default',

src/util/interpolate.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ export function isSupportedInterpolationColorSpace(colorSpace: string): colorSpa
2424
* @returns interpolation fn
2525
* @deprecated use `interpolate[type]` instead
2626
*/
27-
export const interpolateFactory = (interpolationType: 'number'|'color'|'projection-mode'|'array'|'padding'|'variableAnchorOffsetCollection') => {
27+
export const interpolateFactory = (interpolationType: 'number'|'color'|'projectionType'|'array'|'padding'|'variableAnchorOffsetCollection') => {
2828
switch (interpolationType) {
2929
case 'number': return number;
3030
case 'color': return color;
31-
case 'projection-mode': return projection;
31+
case 'projectionType': return projection;
3232
case 'array': return array;
3333
case 'padding': return padding;
3434
case 'variableAnchorOffsetCollection': return variableAnchorOffsetCollection;

src/validate/validate_projection-type.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default function validateProjectionMode(options: ValidateProjectionOption
1717

1818
if (!projectionType){
1919

20-
return [new ValidationError('projection-mode', projectionType, 'projection mode is missing')];
20+
return [new ValidationError('projection.type', projectionType, 'value is missing')];
2121
}
2222

2323
const rootType = getType(projectionType);
@@ -26,13 +26,11 @@ export default function validateProjectionMode(options: ValidateProjectionOption
2626
}
2727

2828
if (rootType === 'string' && !isPrimitiveProjection(projectionType)) {
29-
return [new ValidationError('projection-mode', projectionType, 'does not fit the type PrimitiveProjection')];
30-
} else if (rootType === 'object' && !isProjectionTransition(projectionType)) {
31-
return [new ValidationError('projection-mode', projectionType, 'does not fit the type ProjectionTransition')];
29+
return [new ValidationError('projection.type', projectionType, `found "${projectionType}", expected "mercator" or "globe".`)];
3230
} else if (rootType === 'array' && !isProjectionType(projectionType)) {
33-
return [new ValidationError('projection-mode', projectionType, 'does not fit the type ProjectionType')];
34-
} else if (!['array', 'object', 'string'].includes(rootType)) {
35-
return [new ValidationError('projection-mode', projectionType, `expected array, object, string - found ${rootType}`)];
31+
return [new ValidationError('projection.type', projectionType, `incorrect syntax, found ${JSON.parse(projectionType)}.`)];
32+
} else if (!['array', 'string'].includes(rootType)) {
33+
return [new ValidationError('projection.type', projectionType, `found value of type "${rootType}", expected string or array`)];
3634
}
3735
return [];
3836
}

0 commit comments

Comments
 (0)