Skip to content

Blueprint JSON Schema does not adhere to strict mode for Ajv #3178

@westonruter

Description

@westonruter

Prerequisites

  • I have carried out troubleshooting steps and I believe I have found a bug.
  • I have searched for similar bugs in both open and closed issues and cannot find a duplicate.

Describe the bug

For the current blueprint-schema.json, in the WordPress/performance repo we are using it for JSON Validation (source) with Ajv:

	const ajv = new AjvConstructor( {
		allErrors: true,
		strict: false,
		loadSchema: fetchSchema,
	} );

Note the strict: false. It seems this is required because otherwise Ajv complains with an error:

strict mode: use allowUnionTypes to allow union type keyword at "https://playground.wordpress.net/blueprint-schema.json#/definitions/PHPConstants/additionalProperties" (strictTypes).

Expected behavior

Schema should work in Ajv strict mode.

Actual behavior

Schema violates strict mode.

Steps to reproduce

Use Ajv to validate a blueprint.json with the Blueprint schema, and indicate that it should have strict enabled.

Isolating the problem

  • I have deactivated other plugins and confirmed this bug occurs when only this plugin is active.
  • This bug happens with a default WordPress theme active.
  • I can reproduce this bug consistently using the steps above.

Metadata

Metadata

Assignees

Labels

[Type] BugAn existing feature does not function as intended

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions