Page MenuHomePhabricator

[Story] length limits for Schema inputs
Closed, ResolvedPublic5 Estimated Story Points

Description

Problem:
We need to set some limits for all the input fields related to Schemas.

BDD:
GIVEN a Schema page
WHEN editing it
AND trying to save a value for the label, description, alias or Schema code that is longer than the limit
THEN an error saying "The input can not be saved because it is too long. The limit is XXX" is shown
AND the edit is not saved

WHEN creating a new Schema via Special:NewSchema
AND trying to save a value for the label, description, alias or Schema code that is longer than the limit
THEN an error saying "The input can not be saved because it is too long. The limit is XXX" is shown
AND the new Schema is not saved

Acceptance criteria:

  • Editors can not enter data that violates the length limits.
  • This is validated in the frontend (i.e. in the input) as well

Open questions:

Notes:
This should work on ?action=edit, the Special page for editing existing labels/descriptions/aliases as well as the Special page for creating a new Schema.

Event Timeline

Michael updated the task description. (Show Details)

The longest automatically inferred schema by the Wikidata Shape Expressions Inference tool is #23 at 718 039 bytes. MediaWiki’s default [$wgMaxArticleSize](https://www.mediawiki.org/wiki/Manual:$wgMaxArticleSize) is 2048 “kilobytes” (presumably kibibytes, i. e. 2048×1024 = 2 097 152 bytes?), so some schema length limit around one million bytes should be enough to store even large auto-generated schemas while not exceeding the underlying MediaWiki limit.

(I suppose it’s possible to craft schemas that are significantly longer in JSON format, but I’d expect most real schemas to be not much longer in JSON than they are in plain text.)

Lucas_Werkmeister_WMDE set the point value for this task to 5.

Decision: we’ll go with a configurable limit that defaults to a lower value, e. g. 50 000 bytes. This will also be indicated client-side via a maxlength on the inputs. (We’ll consider improving the browser’s default behavior for maxlength – just stopping to type / paste more input is a bit user-unfriendly.)

Lucas_Werkmeister_WMDE renamed this task from length limits for Schema inputs to [Story] length limits for Schema inputs.Feb 28 2019, 2:36 PM
Lydia_Pintscher claimed this task.
Lydia_Pintscher moved this task from Verification to Done on the Shape Expressions Sprint 5 board.