Skip to content

Commit

Permalink
Use INFO instead of WARNING for unhandled content types
Browse files Browse the repository at this point in the history
  • Loading branch information
javagl committed Feb 15, 2025
1 parent 5bd4965 commit f9663e0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions specs/extensions/MaxarContentGeojonValidationSpec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ describe("Tileset MAXAR_content_geojson extension validation", function () {
const result = await Validators.validateTilesetFile(
"specs/data/extensions/maxarContentGeojson/validTilesetWithGeojson.json"
);
// Expect one warning for skipping the GeoJSON validation
// Expect one info for skipping the GeoJSON validation
// and one for the missing declaration of the
// MAXAR_content_geojson usage in the extensionsUsed
expect(result.length).toEqual(2);
expect(result.get(0).type).toEqual("CONTENT_VALIDATION_WARNING");
expect(result.get(0).type).toEqual("CONTENT_VALIDATION_INFO");
expect(result.get(1).type).toEqual("EXTENSION_FOUND_BUT_NOT_USED");
});

it("detects issues in validTilesetWithMaxarContentGeojson", async function () {
const result = await Validators.validateTilesetFile(
"specs/data/extensions/maxarContentGeojson/validTilesetWithMaxarContentGeojson.json"
);
// Expect one warning for skipping the GeoJSON validation
// Expect one info for skipping the GeoJSON validation
expect(result.length).toEqual(1);
expect(result.get(0).type).toEqual("CONTENT_VALIDATION_WARNING");
expect(result.get(0).type).toEqual("CONTENT_VALIDATION_INFO");
});
});
8 changes: 4 additions & 4 deletions src/validation/ContentDataValidators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,21 +82,21 @@ export class ContentDataValidators {

// Certain content types are known to be encountered,
// but are not (yet) validated. These can either be
// ignored, or cause a warning. In the future, this
// ignored, or cause an info. In the future, this
// should be configurable, probably even on a per-type
// basis, via the command line or a config file
const ignoreUnhandledContentTypes = false;
let geomValidator = Validators.createEmptyValidator();
let vctrValidator = Validators.createEmptyValidator();
let geojsonValidator = Validators.createEmptyValidator();
if (!ignoreUnhandledContentTypes) {
geomValidator = Validators.createContentValidationWarning(
geomValidator = Validators.createContentValidationInfo(
"Skipping 'geom' validation"
);
vctrValidator = Validators.createContentValidationWarning(
vctrValidator = Validators.createContentValidationInfo(
"Skipping 'vctr' validation"
);
geojsonValidator = Validators.createContentValidationWarning(
geojsonValidator = Validators.createContentValidationInfo(
"Skipping 'geojson' validation"
);
}
Expand Down
8 changes: 4 additions & 4 deletions src/validation/Validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -393,26 +393,26 @@ export class Validators {
}

/**
* Creates a `Validator` that only adds a `CONTENT_VALIDATION_WARNING`
* Creates a `Validator` that only adds a `CONTENT_VALIDATION_INFO`
* with the given message to the given context when it is called.
*
* This is used for "dummy" validators that handle content data types
* that are already anticipated (like VCTR or GEOM), but not validated
* explicitly.
*
* @param message - The message for the warning
* @param message - The message for the info
* @returns The new validator
* @internal
*/
static createContentValidationWarning(message: string): Validator<Buffer> {
static createContentValidationInfo(message: string): Validator<Buffer> {
return {
async validateObject(
inputPath: string,
//eslint-disable-next-line @typescript-eslint/no-unused-vars
input: Buffer,
context: ValidationContext
): Promise<boolean> {
const issue = ContentValidationIssues.CONTENT_VALIDATION_WARNING(
const issue = ContentValidationIssues.CONTENT_VALIDATION_INFO(
inputPath,
message
);
Expand Down

0 comments on commit f9663e0

Please sign in to comment.