Draft
Conversation
…n blueprint-schema-validator.js - Updated schema definitions to replace 'type' arrays with 'anyOf' for better clarity and validation accuracy. - Enhanced error handling in validation functions to provide more specific error messages for type mismatches. - Improved overall structure and readability of the validation logic. This change aims to ensure more robust schema validation and clearer error reporting.
… for Ajv compatibility - Introduced a new function to recursively transform JSON Schema type arrays into 'anyOf' format, ensuring compatibility with Ajv's strict mode. - Updated the schema compilation process to utilize the transformed schema, improving validation accuracy and clarity. - This change aims to enhance the robustness of schema validation in the playground environment.
…improved schema validation - Modified the schema definitions for PHPConstants and additional properties to utilize 'anyOf' instead of type arrays. - This change enhances compatibility with Ajv and improves validation accuracy, following recent schema enhancements.
Collaborator
Author
|
@westonruter, I have submitted this PR it solve your issue? |
Member
|
@fellyph I tried modifying WordPress/performance as follows to test the new schema: diff --git a/bin/validate-json.js b/bin/validate-json.js
index 503845ba..1928d098 100755
--- a/bin/validate-json.js
+++ b/bin/validate-json.js
@@ -37,7 +37,7 @@ const schemaCache = new Map();
function createAjv( AjvConstructor ) {
const ajv = new AjvConstructor( {
allErrors: true,
- strict: false, // See <https://github.com/WordPress/wordpress-playground/issues/3178>.
+ strict: true,
loadSchema: fetchSchema,
} );
diff --git a/plugins/performance-lab/.wordpress-org/blueprints/blueprint.json b/plugins/performance-lab/.wordpress-org/blueprints/blueprint.json
index 867cd923..26db6b47 100644
--- a/plugins/performance-lab/.wordpress-org/blueprints/blueprint.json
+++ b/plugins/performance-lab/.wordpress-org/blueprints/blueprint.json
@@ -1,5 +1,5 @@
{
- "$schema": "https://playground.wordpress.net/blueprint-schema.json",
+ "$schema": "https://raw.githubusercontent.com/WordPress/wordpress-playground/685b6b80d04e9deb970ece92b04cccdc430cd67a/packages/playground/blueprints/public/blueprint-schema.json",
"landingPage": "/wp-admin/admin.php?page=perflab-modules",
"plugins": [ "performance-lab" ],
"login": true,I get a different error now:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request updates the
blueprint-schema.jsonschema in the playground blueprints package to improve type validation. The main change replaces the use of thetypearray with the more explicitanyOfkeyword to specify multiple allowed types for properties, which is the recommended approach in JSON Schema.Schema validation improvements:
PHPConstantsdefinition to useanyOffor specifying that property values can be strings, booleans, or numbers, instead of using thetypearray.anyOffor allowing either an object or a string, replacing the previoustypearray usage.PR Related to #3178