Openapi.yml uses patternProperties which is not supported by our dependencies

Created on 29 August 2024, 4 months ago
Updated 19 September 2024, 3 months ago

Overview

In #3455975-11: HTTP API: update /xb-component/{component_id} to list possible prop sources for current entity context β†’ we discovered the patternProperties was not supported.

I put in a fix that used \Drupal\experience_builder\EventSubscriber\ApiResponseValidator::performXbValidation and \Drupal\experience_builder\EventSubscriber\ApiResponseValidator::validateKeys and an addition to the openapi.yml file

          # Add a custom validation method to enforce the key pattern via an OpenAPI extension which are
          # designated with 'x-' prefix.
          # @see https://swagger.io/docs/specification/openapi-extensions
          # @see \Drupal\experience_builder\EventSubscriber\ApiResponseValidator::performXbValidation
          x-xb-validation:
            method: 'validateKeys'
            arguments:
              # @see \Drupal\Core\Plugin\Component::$machineName
              - '^[a-zA-Z0-9_-]+:[a-zA-Z0-9_-]+$'

but in fixing another problem with the openapi.yml file this addition was removed
here is the version with the fix https://git.drupalcode.org/project/experience_builder/-/blob/f649d4bbaea...

Proposed resolution

  1. Add back the x-xb-validation and remove patternProperties that does not work
  2. Add a functional test that calls /xb-components alters the response to test the validation

User interface changes

πŸ› Bug report
Status

Needs work

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States tedbow Ithaca, NY, USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024