Problem/Motivation

The development site has a model and, since the recipe, content for most of it. What it does not have is a single image, file or media item. That is not a cosmetic gap: an endpoint that returns an empty structure and an endpoint that returns nothing because there was nothing to return are indistinguishable from the outside, and the second is what every response on the development site looks like today.

It matters more than the other empty fields because an image does not arrive one way. It arrives as an image field, as a reference to a media entity whose source is an image, as a plain file, and a video arrives as a media item with a remote source. Those are four different handlers, and the shape library issues are about to write all four with nothing to run them against.

Image styles are the second half of the same hole. What this module returns for an image is not a URL but a structure of derivatives, and a derivative needs a style that exists. A site whose settings name styles it does not have produces a structure with nothing in it, and the response looks exactly like the one from a site that has no image at all.

Proposed resolution

  • Real image files, of more than one size, so that a derivative is visibly not the original. One small picture proves nothing: every style produces the same bytes.
  • The demo creates the image styles itself, rather than expecting a site to already have them. A style is part of what a site is, exactly like a content type: the structure this module returns for an image is a set of derivatives, each named after a style, so a demo applied to a clean install with no styles produces a structure with nothing in it - and that is indistinguishable from a site that has no image at all. The styles the module's own settings name have to be among them, or the setting points at nothing.
  • Media types for the sources that matter — an image and a remote video — with content that uses them, so that the media handlers have a subject.
  • Every route an image takes into a response covered by content: an image field, a reference to a media item, a file field. A development site that covers one of the three teaches the wrong lesson about the other two.
  • Keep it optional the way the rest is: media is a core module but not a dependency of this one, so its part of the site comes as its own recipe and its absence is not an error.

Remaining tasks

Everything.

Issue fork myrest-3619678

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

sergeydruua created an issue. See original summary.

  • sergeydruua committed 82845f09 on 1.0.x
    Issue #3619678: Give the development site images, files and media, and...
sergeydruua’s picture

Status: Active » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

sergeydruua’s picture

Status: Fixed » Closed (fixed)