Problem/Motivation

A front end learns about a form twice over. The static data endpoint answers with a block describing every form the site has - its address, its title, the fields it takes, the values of the lists those fields choose from, the text on the button. The submission endpoint holds the same knowledge in another form: which payload keys it accepts, which of them are required, what type each one is, what it is called in the response.

Neither knows about the other. A field added to a submission endpoint is invisible to the front end until someone remembers to add it to the description as well, and a field removed from the description keeps being accepted. The two drift apart silently, and the drift shows up as a form that submits values nothing reads, or asks for values nothing accepts.

Proposed resolution

  • The submission endpoint is the single description: the declaration a submission resource already carries - key, type, required, label - is what the static data block answers with.
  • The block is assembled by asking the registered submission endpoints rather than by a hand-written list, so a site that switches one off stops describing it.
  • What the declaration cannot know stays where it is: the text on a button and the page a submission redirects to belong to the site, not to the endpoint.
  • The values a field chooses from - the branches of a clinic, the messengers of a chat form - keep being resolved as they are now, by the reference the declaration already names.
  • Coverage that a field added to a resource appears in the static data without anything else being edited.

Remaining tasks

Everything.

Issue fork myrest-3623570

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’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)