Compare commits

...

4 Commits

Author SHA1 Message Date
Ben Beckford 05310bda32 chore: re-add integer to a json schema type 2026-07-01 00:46:02 -07:00
Ben Beckford 7fdea5af2c chore: increase precision for lat/lon filtering 2026-07-01 00:42:35 -07:00
Ben Beckford e9afd8c492 Merge branch 'main' into chore/workflow-number-bounds 2026-07-01 00:40:36 -07:00
Ben Beckford 8de420493e chore(server): use bounded numbers in workflows 2026-06-11 18:07:10 -07:00
5 changed files with 22 additions and 9 deletions
+12 -5
View File
@@ -163,19 +163,26 @@
"description": "Filter by distance to a coordinate",
"properties": {
"latitude": {
"type": "string",
"type": "number",
"title": "Latitude",
"description": "GPS latitude of a coordinate which the asset must be close to"
"description": "GPS latitude of a coordinate which the asset must be close to",
"minimum": -90,
"maximum": 90,
"precision": 0.000001
},
"longitude": {
"type": "string",
"type": "number",
"title": "Longitude",
"description": "GPS longitude of a coordinate which the asset must be close to"
"description": "GPS longitude of a coordinate which the asset must be close to",
"minimum": -180,
"maximum": 180,
"precision": 0.000001
},
"radius": {
"type": "number",
"title": "Maximum distance",
"description": "How close in kilometres the asset must be to the given point"
"description": "How close in kilometres the asset must be to the given point",
"minimum": 0
}
}
}
+3 -3
View File
@@ -96,10 +96,10 @@ const methods = wrapper<Manifest>({
return { workflow: { continue: false } };
}
const configLat = Number.parseFloat(config.coordinate?.latitude ?? '');
const configLon = Number.parseFloat(config.coordinate?.longitude ?? '');
const configLat = config.coordinate?.latitude;
const configLon = config.coordinate?.longitude;
if (Number.isNaN(configLat) || Number.isNaN(configLat)) {
if (configLat === undefined || configLon === undefined) {
return { workflow: { continue: true } };
}
+3
View File
@@ -12,6 +12,9 @@ const JsonSchemaPropertySchema = z
description: z.string().describe('Description'),
default: z.any().optional().describe('Default value'),
enum: z.array(z.string()).optional().describe('Valid choices for enum types'),
minimum: z.number().optional().describe('Minimum value for number types'),
maximum: z.number().optional().describe('Maximum value for number types'),
precision: z.number().default(1).optional().describe('Smallest interval (granularity) for number types'),
array: z.boolean().optional().describe('Type is an array type'),
required: z.array(z.string()).optional().describe('A list of required properties'),
uiHint: z
@@ -100,7 +100,7 @@
</Field>
{:else if schema.type === 'number'}
<Field {label} {description}>
<NumberInput bind:value={getNumber, setValue} />
<NumberInput bind:value={getNumber, setValue} step={schema.precision} min={schema.minimum} max={schema.maximum} />
</Field>
{:else if schema.type === 'string'}
<Field {label} {description}>
+3
View File
@@ -93,6 +93,9 @@ export type JSONSchemaProperty = {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
default?: any;
enum?: string[];
minimum?: number;
maximum?: number;
precision?: number;
array?: boolean;
properties?: Record<string, JSONSchemaProperty>;
required?: string[];