Change record status: 
Project: 
Introduced in branch: 
9.1.x
Introduced in version: 
9.1.0-beta5
Description: 

Prior to the 9.1.0-Beta5 release, all schema "$ref" properties were passed through the \Drupal\patternkit\PatternLibraryJSONParserTrait::schemaDereference() method with the goal of rewriting namespaced pattern references to a local URL for fetching of the related schema through the Patternkit API controller. The result would typically map an existing namespaced pattern like @patternkit/atoms/example_ref/../example/src/example.json, as seen in the patternkit_example module's example_ref schema, to /api/patternkit/patternkit/atoms/example/src/example.json instead.

As of the 9.1.0-Beta5 release, this method has been deprecated and replaced by the \Drupal\patternkit\PatternLibraryJSONParserTrait::dereferenceSchema() method. Instead of trying to manually traverse the schema and alter the reference values, this method uses the newly added swaggest/json-schema library to process and flatten all referenced schemas. The result of this change is:

  • Database-cached schema data no longer contains references, but instead contains the fully resolved schema including all nested contents.
  • Schemas loaded for the JSON Editor UI no longer contain references for fetching and should load the form much more quickly.

Deprecations and Replacements

The \Drupal\patternkit\PatternLibraryJSONParserTrait::schemaDereference() method has been marked as deprecated and will be removed leading up to the stable 9.1.0 release. Any usage of this method should be replaced with the \Drupal\patternkit\PatternLibraryJSONParserTrait::dereferenceSchema() method instead.

Impacts: 
Site builders, administrators, editors
Module developers