Skip to content

Commit c44f406

Browse files
committed
Ship the examples as raw fixture files
Imported as raw text via Vite's ?raw suffix (build-cli implements the same for the CLI bundle since standards-checker 1.2.0-beta.2), so the editor shows the fixtures verbatim — e.g. the JSON-FG geometry arrays stay inline instead of one number per line.
1 parent 0545a60 commit c44f406

3 files changed

Lines changed: 18 additions & 8 deletions

File tree

.changeset/raw-example-fixtures.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
'@geonovum/ogc-checker': patch
3+
---
4+
5+
Ship the examples as raw fixture files: they are imported as raw text (Vite's
6+
`?raw` suffix, implemented for the CLI bundle by `build-cli` since
7+
`@geonovum/standards-checker` 1.2.0-beta.2) and render verbatim in the editor
8+
with the fixtures' own formatting.

src/standards/json-fg/standard.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import type { Standard } from '@geonovum/standards-checker';
2-
import example from './examples/feature.json';
2+
// The example is imported as raw text (`?raw`) and appears verbatim in the editor.
3+
import example from './examples/feature.json?raw';
34
import rulesets from './rulesets';
45

56
const sourceLabel = (confClass: string) => confClass.replace('http://www.opengis.net/spec/', '');
@@ -12,7 +13,7 @@ export const jsonFgStandard: Standard = {
1213
id: '1.0.0',
1314
label: '1.0.0',
1415
status: 'final',
15-
example: JSON.stringify(example, undefined, 2),
16+
example,
1617
rulesets,
1718
sourceLabel,
1819
legacySlug: 'json-fg',

src/standards/ogc-api/standard.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ import {
77
type VersionResponseMapper,
88
} from '@geonovum/standards-checker';
99
import type { RulesetDefinition } from '@geonovum/standards-checker/spectral/core';
10-
import featuresExample from './examples/features.json';
11-
import processesExample from './examples/processes.json';
12-
import recordsExample from './examples/records.json';
10+
// Examples are imported as raw text (`?raw`) and appear verbatim in the editor.
11+
import featuresExample from './examples/features.json?raw';
12+
import processesExample from './examples/processes.json?raw';
13+
import recordsExample from './examples/records.json?raw';
1314
import rulesets from './rulesets';
1415

1516
const sourceLabel = (confClass: string) => confClass.replace('http://www.opengis.net/spec/', '');
@@ -84,7 +85,7 @@ export const ogcApiFeaturesStandard: Standard = {
8485
id: '1.0.1',
8586
label: '1.0.1',
8687
status: 'final',
87-
example: JSON.stringify(featuresExample, undefined, 2),
88+
example: featuresExample,
8889
rulesets: featuresRulesets,
8990
sourceLabel,
9091
responseMapper: responseMapper(featuresRulesets),
@@ -101,7 +102,7 @@ export const ogcApiProcessesStandard: Standard = {
101102
id: '2.0.0',
102103
label: '2.0.0',
103104
status: 'draft',
104-
example: JSON.stringify(processesExample, undefined, 2),
105+
example: processesExample,
105106
rulesets: processesRulesets,
106107
sourceLabel,
107108
responseMapper: responseMapper(processesRulesets),
@@ -118,7 +119,7 @@ export const ogcApiRecordsStandard: Standard = {
118119
id: '1.0.0',
119120
label: '1.0.0',
120121
status: 'final',
121-
example: JSON.stringify(recordsExample, undefined, 2),
122+
example: recordsExample,
122123
rulesets: recordsRulesets,
123124
sourceLabel,
124125
responseMapper: responseMapper(recordsRulesets),

0 commit comments

Comments
 (0)