Closed ThomasLocke closed 11 years ago
Done. We now have a simple system implemented in the Response package. This is a natural place for it, as we have the AWS.Status.Data object available here.
Reopening this one because the current system is too weak. Optimally we should have a system where the parts of the REST interface protocol that deals with request parameters are described in a central place and then compiled to validation methods when building Alice. Even better would be if these validation methods could return an Ada record with the necessary request data already cast to whatever types they ultimately are in Alice.
Plan: Formulate the specification of the REST interfaces as a number of (possibly overloaded) Ada procedure specifications. Use OpenToken (or something similar) to parse the specification and generate the validation and extraction routines.
Example:
with Alice_REST_Types;
package REST_Interface is
procedure Agent;
procedure Agent_List;
procedure Contact (ID : in Alice_REST_Types.Contact_Identifier);
procedure Organization (ID : in Alice_REST_Types.Organization_Identifier);
end REST_Interface;
To simplify things, we only accept a single with
declaration with a list of packages. Arguments to procedures can only be in
. For each <package>.<type>
, we assume the existence of
function <package>.Is_<type> (Item : in String) return Boolean
We save this for later.
The current interfaces have fairly individual ways of validating the HTTP request parameters. This should be changed to a more general method, where each interface can register the required and optional request parameters alongside methods to validate them.