Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@
"ts-jest": "^26.4.4",
"ts-node": "^9.1.1",
"typedoc": "^0.24.7",
"typescript": "^4.2.4"
"typescript": "^4.2.4",
"zod": "~3.25.76"
},
"dependencies": {
"@types/geojson": "^7946.0.16",
Expand Down
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ export * from './enums/geo/epsg';
export * from './helpers/mime';
export * from './types/countryTranslation';
export * from './interfaces';
export * from './schemas';
1 change: 1 addition & 0 deletions src/schemas/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './serving-proxy/capability.schema';
32 changes: 32 additions & 0 deletions src/schemas/serving-proxy/capability.schema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { z } from 'zod';

export const StyleSchema = z.object({
value: z.string().min(1).describe('Style identifier value'),
isDefault: z.string().min(1).nullable().describe('Whether this style is the default style'),
});

export const TileMatrixSetSchema = z.object({
tileMatrixSetID: z.string().min(1).describe('Identifier of the TileMatrixSet'),
tileMatrixLabels: z.array(z.string().min(1)).min(1).describe('TileMatrix identifier per level'),
});

export const ResourceURLSchema = z.object({
format: z.string().min(1).describe('MIME type of the resource'),
resourceType: z.string().min(1).describe('Type of the resource, e.g. tile'),
template: z.string().min(1).describe('URL template for the resource'),
});

export const CapabilitySchema = z.object({
id: z.string().min(1).describe('Layer identifier'),
style: z.array(StyleSchema).min(1).describe('Styles available for the layer'),
format: z.array(z.string().min(1)).min(1).describe('MIME types supported by the layer'),
tileMatrixSet: z.array(TileMatrixSetSchema).min(1).describe('TileMatrixSets available for the layer'),
url: z.array(ResourceURLSchema).min(1).describe('Resource URLs available for the layer'),
});

// Inferred TypeScript types
export type Style = z.infer<typeof StyleSchema>;
export type TileMatrixSet = z.infer<typeof TileMatrixSetSchema>;
export type ResourceURL = z.infer<typeof ResourceURLSchema>;
export type Capability = z.infer<typeof CapabilitySchema>;
Loading