Commit b484f429 authored by Simon Morvan's avatar Simon Morvan Committed by Mateu Aguiló Bosch
Browse files

Issue #3202870 by bradjones1, garphy, e0ipso: Fix JSON schema for image style enhancer

parent b2cbcc22
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -80,6 +80,8 @@ class ImageStylesProvider implements ImageStylesProviderInterface {
      'meta' => [
        'rel' => static::DERIVATIVE_LINK_REL,
      ] + $dimensions,
      // This is json:api 1.1 compatible.
      'rel' => static::DERIVATIVE_LINK_REL,
    ];
  }

+48 −26
Original line number Diff line number Diff line
@@ -155,6 +155,9 @@ class ImageStyles extends ResourceFieldEnhancerBase implements ContainerFactoryP
   */
  public function getOutputJsonSchema() {
    return [
      'type' => 'object',
      'properties' => [
        'data' => [
          'type' => 'object',
          'properties' => [
            'type' => ['type' => 'string'],
@@ -162,8 +165,20 @@ class ImageStyles extends ResourceFieldEnhancerBase implements ContainerFactoryP
            'meta' => [
              'type' => 'object',
              'properties' => [
            'height' => ['type' => 'integer'],
            'width' => ['type' => 'integer'],
                'height' => [
                  'anyOf' => [
                    ['type' => 'integer'],
                    ['type' => 'null'],
                    ['type' => 'string'],
                  ],
                ],
                'width' => [
                  'anyOf' => [
                    ['type' => 'integer'],
                    ['type' => 'null'],
                    ['type' => 'string'],
                  ],
                ],
                'alt' => [
                  'anyOf' => [
                    ['type' => 'string'],
@@ -176,6 +191,9 @@ class ImageStyles extends ResourceFieldEnhancerBase implements ContainerFactoryP
                    ['type' => 'null'],
                  ],
                ],
                'imageDerivatives' => [
                  'type' => 'object',
                  'properties' => [
                    'links' => [
                      'type' => 'object',
                      'patternProperties' => [
@@ -183,12 +201,16 @@ class ImageStyles extends ResourceFieldEnhancerBase implements ContainerFactoryP
                          'type' => 'object',
                          'properties' => [
                            'href' => ['type' => 'string', 'format' => 'uri'],
                    'meta' => [
                      'type' => 'object',
                      'properties' => [
                            'rel' => [
                          'type' => 'array',
                          'items' => ['type' => 'string', 'format' => 'uri'],
                              'type' => 'string',
                            ],
                            'title' => [
                              'type' => 'string',
                            ],
                            'type' => [
                              'type' => 'string',
                            ],
                          ],
                        ],
                      ],
                    ],