Problem/Motivation

The specification now describes what every endpoint shares - the error responses, the pagination and sorting parameters, and a 200 that is always present - and MyrestResourceBase::getOpenapiResponseSchema() is the hook through which a resource describes the body it returns. Only one resource fills it in so far, so a consumer still cannot generate a typed client for the rest.

Proposed resolution

  • Implement getOpenapiResponseSchema() for each resource, group by group, starting with the node and taxonomy term resources that the front end reads most.
  • Describe the shapes the structure builders return - image, menu, paragraph, price - once, and reference them from the resources that embed them, rather than repeating the same object in forty places.
  • Add an example response per endpoint.
  • Assert each schema against what the resource actually returns, in the same way the global variables resource is covered, so the documentation cannot drift from the response.

Remaining tasks

Work through the resource groups.

User interface changes

Swagger UI shows the response shape of every endpoint.

API changes

None.

Issue fork myrest-3617555

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 9d5f83f4 on 1.0.x
    Issue #3617555: Describe the response body of each resource
    
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)