create new tag
, view all tags

Feature Proposal: Harmonize the Schema Definitions Used


There are currently two ways how schemas are defined in TWiki

TWiki core and various plugins use one or the other. This makes it tedious for the user as the user must always know which of the two schema definition styles are needed for a certain application.

In my plugins, I end up always supporting both to avoid confusion for the user. That is a deterrent for plugin writers.

Description and Documentation

Standardize on a single schema definition and support the needs of either. Alternatively, provide an abstraction for both styles of schema definitions and provide them in the Func API or by a Contrib.



WhatDoesItAffect: Usability


-- Contributors: ThomasWeigert - 2010-09-11


I am not sure I follow. Can you bring an example?

-- PeterThoeny - 2010-09-14

Sorry for being too terse.

For various uses of TWiki as mini-database, we define a schema. There are two techniques:

One is to use a TWiki form, where each row in the form definition defines a column in the schema.


|*Name*  |*Type*  |*Size*  |*Values*  |*Tooltip message*  |*Attributes*  |
| Country | text | 40 | | | |
| State | text | 40 | | | |
| Address | textarea | 40x6 | | | |
| Date | date |  | | | |

The other one is the method used in EditTablePlugin and EditRowPlugin. There the schema is defined by the format and header attribute, such that each element in the comma separated list defines a column in the schema.


%EDITTABLE{ header="|*Country*|*State*|*Address*|*Date*|" format="|text,40|text,40|textarea,6x40|date|" }%

Now the dilemma for a plugin writer is that one has to choose one method or the other or both, when a schema definition is required. For example, the FormQueryPlugin uses the EditTablePlugin style definition to declare the schema for its queries when they apply to embedded tables. Many other plugins use forms for the same purpose.

By the way, notice the difference in how the textarea is defined, see HarmonizeTextAreaDefinition.

-- ThomasWeigert - 2010-09-15

We need to keep the format="" parameter of EditTablePlugin to remain compatible with existing text.

As an idea, how about adding a new feature to EditTablePlugin that allows one to specify a TWikiForm topic as the schema, such as format="ContactForm".

-- PeterThoeny - 2010-09-20

Well... I was hoping for a solution which would not require a plugin writer to implement two different but equivalent approaches. That is the current situation. Your suggestion makes it a little simpler by using only one syntax to reference the schema, but the work for the plugin writer is still the same.

One solution I think would be to write an API for this that accepts either format. That is, in Func we have some function "find schema" that does the right thing, whether the schema was in form syntax or edit table syntax. Then a plugin writer could just use the schema and not worry about how it was defined. And then, the user, of course, would not have to worry either and could use whatever they remember.

I think such API function would be very useful for many plugins.

-- ThomasWeigert - 2010-09-20


-- PeterThoeny - 2010-09-20

Edit | Attach | Watch | Print version | History: r6 < r5 < r4 < r3 < r2 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r6 - 2010-09-20 - PeterThoeny
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by Perl Hosted by OICcam.com Ideas, requests, problems regarding TWiki? Send feedback. Ask community in the support forum.
Copyright © 1999-2018 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.