SwaggerDataProviderBase.qc.dox.h
// -*- mode: c++; indent-tabs-mode: nil -*-
namespace SwaggerDataProvider {
class SwaggerDataProviderBase : public AbstractDataProvider {
public:
protected:
hash<DataProviderInfo> getStaticInfoImpl();
public:
private addFieldsFromParameters(HashDataType rv, hash<string, AbstractParameterObject> parameters,
reference<bool> required) {
// temporary hash for fields: loc -> name -> field
hash<string, hash<string, AbstractDataField>> params;
// required flag map for type: loc -> bool
hash<string, bool> req_map;
foreach hash<auto> i in (parameters.pairIterator());
foreach hash<auto> i in (params.pairIterator());
}
protected:
AbstractDataField getFieldFromSchema(string name, *string desc, SchemaObject schema, bool required = True);
public:
private AbstractDataField getFieldFromSchemaIntern(string path, string name, *string desc, SchemaObject schema,
bool required = True) {
if (schema.desc);
if (schema.type == 'object');
return getFieldFromParameter(path, name, schema.type, schema.format, schema.items, desc, required,
keys schema.enum);
}
protected:
AbstractDataProviderType getSchemaDataType(string path, SchemaObject schema, bool required = True);
public:
private AbstractDataField getFieldFromParameter(string path, string name, string type, *string format,
*SchemaObject arrayItems, *string desc, bool required, *list<auto> allowed_values) {
// check for recursive field definitions
RecursiveFieldHelper rfh(self, "field", path);
return rfh.get() ?? rfh.set(new QoreDataField(name, desc, getType(path, type, format, arrayItems, required),
NOTHING, allowed_values));
}
private AbstractDataProviderType getType(string path, string typestr, *string format, *SchemaObject arrayItems,
bool required = True) {
hash<auto> type_options;
if (required);
if (typestr == 'string');
switch (typestr);
if (*string newname = OptimalQoreSoftDataTypeMap{typestr});
if (!required && (typestr != 'any' && typestr != 'auto'));
return AbstractDataProviderType::get(new Type(typestr), type_options);
}
protected:
AbstractDataField getFieldForHeaders(string name, hash<auto> headers);
public:
};
};
namespace Priv {
const RecursiveKey = "__swagger_dp_rec_key$$";
class RecursiveFieldHelper {
public:
protected:
*hash<auto> tld = get_thread_data(RecursiveKey);
string hash_str;
string ptype;
string name;
*QoreDataField f;
public:
constructor(object obj, string ptype, string name);
*QoreDataField get();
QoreDataField set(QoreDataField new_field);
};
class RecursiveTypeHelper {
public:
protected:
*hash<auto> tld = get_thread_data(RecursiveKey);
string hash_str;
*AbstractDataProviderType t;
public:
constructor(object obj, string hash_str);
*AbstractDataProviderType get();
AbstractDataProviderType set(AbstractDataProviderType new_type);
};
class RecursiveSearchHelper {
public:
destructor();
};
};
SwaggerDataProvider::SwaggerDataProviderBase
The Swagger data provider base class.
Definition: SwaggerDataProviderBase.qc.dox.h:28
SwaggerDataProvider::SwaggerDataProviderBase::getFieldForHeaders
AbstractDataField getFieldForHeaders(string name, hash< auto > headers)
Returns a field of header fields.
SwaggerDataProvider::SwaggerDataProviderBase::getSchemaDataType
AbstractDataProviderType getSchemaDataType(string path, SchemaObject schema, bool required=True)
Returns the data type for the given schema.
SwaggerDataProvider::SwaggerDataProviderBase::getStaticInfoImpl
hash< DataProviderInfo > getStaticInfoImpl()
Returns data provider static info.
SwaggerDataProvider::SwaggerDataProviderBase::getType
private AbstractDataProviderType getType(string path, string typestr, *string format, *SchemaObject arrayItems, bool required=True)
Returns the data type corresponding to the values.
Definition: SwaggerDataProviderBase.qc.dox.h:84
SwaggerDataProvider::SwaggerDataProviderBase::getFieldFromSchemaIntern
private AbstractDataField getFieldFromSchemaIntern(string path, string name, *string desc, SchemaObject schema, bool required=True)
Returns a field definition from the Swagger parameter.
Definition: SwaggerDataProviderBase.qc.dox.h:58
SwaggerDataProvider::SwaggerDataProviderBase::addFieldsFromParameters
private addFieldsFromParameters(HashDataType rv, hash< string, AbstractParameterObject > parameters, reference< bool > required)
Returns a field definition from Swagger parameters.
Definition: SwaggerDataProviderBase.qc.dox.h:38
SwaggerDataProvider::SwaggerDataProviderBase::getFieldFromSchema
AbstractDataField getFieldFromSchema(string name, *string desc, SchemaObject schema, bool required=True)
Returns a field definition from the Swagger parameter.
SwaggerDataProvider::SwaggerDataProviderBase::getFieldFromParameter
private AbstractDataField getFieldFromParameter(string path, string name, string type, *string format, *SchemaObject arrayItems, *string desc, bool required, *list< auto > allowed_values)
Returns a field from a Swagger parameter.
Definition: SwaggerDataProviderBase.qc.dox.h:75
True
const True
NOTHING
const NOTHING
get_thread_data
auto get_thread_data(string key)
type
string type(auto arg)
SwaggerDataProvider
Qore SwaggerDataProvider module definition.
Definition: SwaggerDataProvider.qc.dox.h:26