222 hash<RestRequestClientInfo>
processRequest(
string method,
string path,
auto body, *hash<auto> headers, *softlist<string> content_types);
241 hash<RestRequestServerInfo>
parseRequest(
string method,
string path, *data http_body, reference<hash<auto>> headers);
267 hash<HttpResponseInfo>
processResponse(
string method,
string path,
int code,
auto response_body, *hash<auto> headers, *softlist<string> content_types);
279 hash<RestResponseClientInfo>
parseResponse(
string method,
string path,
int code, *data response_body, hash<auto> hdr);
298 hash<RestExampleRequestInfo>
getExampleRequest(
string method,
string path, *softlist<string> content_types);
319 hash<RestExampleResponseInfo>
getExampleResponse(
string method,
string path,
int code, *softlist<string> content_types);
420 abstract hash<RestRequestClientInfo>
processRequestImpl(
string method,
string path,
auto body, *hash<auto> headers, *softlist<string> content_types);
436 abstract hash<RestRequestServerInfo>
parseRequestImpl(
string method,
string path, *data http_body, reference<hash> headers);
456 abstract hash<HttpResponseInfo>
processResponseImpl(
string method,
string path,
int code,
auto response_body, *hash<auto> headers, *softlist<string> content_types);
469 abstract hash<RestResponseClientInfo>
parseResponseImpl(
string method,
string path,
int code, *data response_body, hash<auto> hdr);
511 abstract hash<RestExampleRequestInfo>
getExampleRequestImpl(
string method,
string path, *softlist<string> content_types);
534 abstract hash<RestExampleResponseInfo>
getExampleResponseImpl(
string method,
string path,
int code, *softlist<string> content_types);
563 MimeTypeJson: \make_json(),
566 MimeTypeYamlRpc: \make_yaml(),
567 MimeTypeYaml: \make_yaml(),
570 MimeTypeXml: \make_xmlrpc_value(),
571 MimeTypeXmlApp:
string sub (
auto v) {
572 switch (v.typeCode()) {
573 case NT_LIST:
return make_xml((
"list": (
"element": v)));
574 case NT_HASH:
return v.size() == 1 && v.firstValue().lsize() == 1 ? make_xml(v) : make_xml((
"value": v));
576 return make_xml((
"value": v));
579 MimeTypeFormUrlEncoded:
string sub (
auto v) {
580 if (v.typeCode() == NT_HASH)
581 return mime_get_form_urlencoded_string(v);
582 throw "FORMURLENCODING-ERROR", sprintf(
"form URL encoding can only encode hashes; type %y requested", v.type());
584 MimeTypeText: data sub (
auto s) {
585 switch (s.typeCode()) {
594 throw "TEXT-SERIALIZATION-ERROR", sprintf(
"cannot serialize type %y without YAML support", s.type());
598 MimeTypeOctetStream: binary sub (
auto s) {
599 switch (s.typeCode()) {
605 # issue #3547: send as a YAML-serialized string if possible to catch unserializable data
607 return binary(make_yaml(s));
609 throw "BINARY-SERIALIZATION-ERROR", sprintf(
"cannot serialize type %y without YAML support", s.type());
617 const DeserializeYaml = ...;
619 const DeserializeXml = ...;
624 MimeTypeFormUrlEncoded: (
626 "in": \mime_parse_form_urlencoded_string(),
635 MimeTypeYamlRpc: DeserializeYaml,
636 MimeTypeYaml: DeserializeYaml,
639 MimeTypeXml: DeserializeXml,
640 MimeTypeXmlApp: DeserializeXml,
644 "in": data sub (data s) {
return s; },
647 MimeTypeOctetStream: {
649 "in": binary sub (data s) {
650 return s.typeCode() == NT_BINARY ? s : binary(s);
698 hash<RestRequestClientInfo>
processRequestImpl(
string method,
string path,
auto body, *hash<auto> headers, *softlist<string> content_types);
715 hash<RestRequestServerInfo>
parseRequestImpl(
string method,
string path, *data http_body, reference<hash> headers);
744 hash<HttpResponseInfo>
processResponseImpl(
string method,
string path,
int code,
auto response_body, *hash<auto> headers, *softlist<string> content_types);
758 hash<RestResponseClientInfo>
parseResponseImpl(
string method,
string path,
int code, *data response_body, hash<auto> hdr);
845 hash<RestExampleResponseInfo>
getExampleResponseImpl(
string method,
string path,
int code, *softlist<string> content_types);
abstract REST schema validation classes
Definition: RestSchemaValidator.qm.dox.h:184
bool managesUriPath()
returns True if the provider manages the URI path
abstract hash< RestRequestServerInfo > parseRequestImpl(string method, string path, *data http_body, reference< hash > headers)
processes and parses a client request and returns the deserialized message body (if any)
abstract hash< RestRequestClientInfo > processRequestImpl(string method, string path, auto body, *hash< auto > headers, *softlist< string > content_types)
processes a client-side REST request and returns a hash that can be used to make the outgoing client-...
abstract hash< RestExampleRequestInfo > getExampleRequestImpl(string method, string path, *softlist< string > content_types)
returns a hash of example message information for the given request
hash< RestRequestClientInfo > processRequest(string method, string path, auto body, *hash< auto > headers, *softlist< string > content_types)
processes a client-side REST request and returns a hash that can be used to make the outgoing client-...
abstract hash< RestResponseClientInfo > parseResponseImpl(string method, string path, int code, *data response_body, hash< auto > hdr)
parses and validates the response from the server and returns a hash of the processed info
abstract hash< RestExampleResponseInfo > getExampleResponseImpl(string method, string path, int code, *softlist< string > content_types)
returns a hash of example message information for the given request
hash< RestExampleRequestInfo > getExampleRequest(string method, string path, *softlist< string > content_types)
returns a hash of example message information for the given request
*TimeZone getTimeZoneLocale()
Returns the time zone locale used for serialization / deserialization.
DataProvider::AbstractDataProvider getDataProviderImpl(HTTPClient rest)
returns a data provider object for this connection, if supported by any REST schema validator object
string getTargetUrl()
returns the target URL for the schema
abstract string getHashImpl()
returns a unique hash for the schema that can be used to compare schemas
hash< RestQoreExampleCodeInfo > getQoreExampleRequest(string method, string path)
returns a hash of example Qore code for the given request
abstract setBasePathImpl(string basePath)
overrides the basePath value
hash< RestQoreExampleCodeInfo > getQoreExampleResponse(string method, string path, int code)
returns example Qore code for the given response
abstract setTimeZoneLocaleImpl(*TimeZone tz)
Allows the time zone locale to be set for serialization / deserialization.
abstract string getTargetUrlImpl()
returns the target URL for the schema
constructor(Logger::LoggerInterface logger)
Creates the object with the given logger.
abstract *TimeZone getTimeZoneLocaleImpl()
Returns the time zone locale used for serialization / deserialization.
constructor()
Creates the object without a logger.
abstract hash< string, list< string > > getPathOperationHashImpl()
returns a hash of URI paths as keys with values as lists of supported HTTP methods
hash< RestRequestServerInfo > parseRequest(string method, string path, *data http_body, reference< hash< auto > > headers)
processes and parses a client request and returns the deserialized message body (if any)
abstract string getBasePathImpl()
returns the base path prefix for all requests in this schema
hash< HttpResponseInfo > processResponse(string method, string path, int code, auto response_body, *hash< auto > headers, *softlist< string > content_types)
Processes a REST response with a serialized message body.
setTimeZoneLocale(*TimeZone tz)
Allows the time zone locale to be set for serialization / deserialization.
string getHash()
returns a unique hash for the schema that can be used to compare schemas
DataProvider::AbstractDataProvider getDataProvider(HTTPClient rest)
returns a data provider object for this connection, if supported by any REST schema validator object
hash< string, list< string > > getPathOperationHash()
returns a hash of URI paths as keys with values as lists of supported HTTP methods
hash< RestResponseClientInfo > parseResponse(string method, string path, int code, *data response_body, hash< auto > hdr)
parses and validates the response from the server and returns a hash of the processed info
abstract hash< RestQoreExampleCodeInfo > getQoreExampleResponseImpl(string method, string path, int code)
returns example Qore code for the given response
string getBasePath()
returns the base path prefix for all requests in this schema
abstract hash< RestQoreExampleCodeInfo > getQoreExampleRequestImpl(string method, string path)
returns a hash of example Qore code for the given request
abstract hash< HttpResponseInfo > processResponseImpl(string method, string path, int code, auto response_body, *hash< auto > headers, *softlist< string > content_types)
processes a REST response with a serialized message body, validates any response data against schema ...
hash< RestExampleResponseInfo > getExampleResponse(string method, string path, int code, *softlist< string > content_types)
returns a hash of example message information for the given request
setBasePath(string basePath)
overrides the basePath value
null REST validator; no schema is used but default serialization and deserialization is performed
Definition: RestSchemaValidator.qm.dox.h:557
setBasePathImpl(string basePath)
overrides the basePath value
string getHashImpl()
returns a unique hash for the schema that can be used to compare schemas
const DataDeserializationSupport
Data deserialization support MIME types to codes and de/serialization functions.
Definition: RestSchemaValidator.qm.dox.h:623
hash< RestExampleRequestInfo > getExampleRequestImpl(string method, string path, *softlist< string > content_types)
returns a hash of example message information for the given request
const DataSerializationSupport
Data serialization support mapping codes to MIME types and de/serialization functions.
Definition: RestSchemaValidator.qm.dox.h:561
*TimeZone getTimeZoneLocaleImpl()
Returns the time zone locale used for serialization / deserialization.
hash< RestRequestClientInfo > processRequestImpl(string method, string path, auto body, *hash< auto > headers, *softlist< string > content_types)
processes a client-side REST request and returns a hash that can be used to make the outgoing client-...
const NullSchemaHashStr
a unique hash for the null schema
Definition: RestSchemaValidator.qm.dox.h:658
hash< HttpResponseInfo > processResponseImpl(string method, string path, int code, auto response_body, *hash< auto > headers, *softlist< string > content_types)
processes a REST response with a serialized message body, validates any response data against schema ...
setTimeZoneLocaleImpl(*TimeZone tz)
Allows the time zone locale to be set for serialization / deserialization.
string getTargetUrlImpl()
returns the target URL for the schema
bool managesUriPath()
returns True if the provider manages the URI path
hash< RestQoreExampleCodeInfo > getQoreExampleResponseImpl(string method, string path, int code)
returns example Qore code for the given response
hash< RestQoreExampleCodeInfo > getQoreExampleRequestImpl(string method, string path)
returns a hash of example Qore code for the given request
hash< RestRequestServerInfo > parseRequestImpl(string method, string path, *data http_body, reference< hash > headers)
processes and parses a client request and returns the deserialized message body (if any)
hash< RestExampleResponseInfo > getExampleResponseImpl(string method, string path, int code, *softlist< string > content_types)
returns a hash of example message information for the given request
string getBasePathImpl()
returns the base path prefix for all requests in this schema
hash< string, list< string > > getPathOperationHashImpl()
returns a hash of URI paths as keys with values as lists of supported HTTP methods
hash< RestResponseClientInfo > parseResponseImpl(string method, string path, int code, *data response_body, hash< auto > hdr)
parses and validates the response from the server and returns a hash of the processed info
bool checkResponseContentTypeHeader(reference< hash< HttpResponseInfo > > resp, auto body, *hash< auto > headers, *softlist< string > content_types)
Check if the headers contain a content-type header which is accepted and if so, modify the response h...
main namespace for all public RestSchemaValidator declarations
Definition: RestSchemaValidator.qm.dox.h:111
a hash giving example info for example HTTP request messages
Definition: RestSchemaValidator.qm.dox.h:153
string body
the HTTP request body
Definition: RestSchemaValidator.qm.dox.h:159
hash< auto > hdr
the HTTP request header hash
Definition: RestSchemaValidator.qm.dox.h:157
string request_uri
the HTTP request URI
Definition: RestSchemaValidator.qm.dox.h:155
a hash giving example info for example HTTP response messages
Definition: RestSchemaValidator.qm.dox.h:163
int code
the HTTP status code
Definition: RestSchemaValidator.qm.dox.h:167
string response_uri
the HTTP response URI
Definition: RestSchemaValidator.qm.dox.h:165
string body
the HTTP response body
Definition: RestSchemaValidator.qm.dox.h:171
hash< auto > hdr
the HTTP response header hash
Definition: RestSchemaValidator.qm.dox.h:169
a hash giving example information for building a request or response in Qore
Definition: RestSchemaValidator.qm.dox.h:175
string example
a string giving the example code generation
Definition: RestSchemaValidator.qm.dox.h:180
hash< string, string > hashdecls()
a hash giving example hashdecl declarations for hash objects in the message; keys are hashdecl names; str...
a hash of information about a client-side request
Definition: RestSchemaValidator.qm.dox.h:113
*list< string > response_content
Content-Type for the response message if available.
Definition: RestSchemaValidator.qm.dox.h:121
*data body
the serialized message body hash
Definition: RestSchemaValidator.qm.dox.h:123
string content
the Content-Type for the message
Definition: RestSchemaValidator.qm.dox.h:117
string uri_path
the URI path for the request
Definition: RestSchemaValidator.qm.dox.h:115
a hash of information about a server-side request
Definition: RestSchemaValidator.qm.dox.h:127
*hash< auto > path_args
any path arguments
Definition: RestSchemaValidator.qm.dox.h:133
hash< auto > info
miscellaneous free-form info about the parsed request
Definition: RestSchemaValidator.qm.dox.h:137
string path
the URI path without query arguments
Definition: RestSchemaValidator.qm.dox.h:129
*hash< auto > query
any query arguments
Definition: RestSchemaValidator.qm.dox.h:131
auto body
the deserialized message body data
Definition: RestSchemaValidator.qm.dox.h:135
a hash of information about a response from the server
Definition: RestSchemaValidator.qm.dox.h:141
hash< auto > hdr
the HTTP headers received
Definition: RestSchemaValidator.qm.dox.h:147
int code
the HTTP status code
Definition: RestSchemaValidator.qm.dox.h:143
hash< auto > info
miscellaneous free-form info about the parsed response
Definition: RestSchemaValidator.qm.dox.h:149
auto body
the deserialized message body
Definition: RestSchemaValidator.qm.dox.h:145