json::QuickBuilder PropertyRestrictions<Key, KeyValue, Container>::GetSchema()
    {
        json::QuickBuilder schema( GetSchemaBase() );
        auto tn = JsonConfigurable::_typename_label();
        auto ts = JsonConfigurable::_typeschema_label();

        // this is kind of hacky, but there only two types right now.
        if( std::string( typeid(Key).name() ) == "class Kernel::IPKey" )
        {
            schema[ tn ] = json::String( "idmType:PropertyRestrictions" );
        }
        else
        {
            schema[ tn ] = json::String( "idmType:NodePropertyRestrictions" );
        }
        schema[ ts ] = json::Array();
        schema[ ts ][0] = json::Object();
        schema[ ts ][0]["<key>"] = json::Object();
        schema[ ts ][0]["<key>"][ "type" ] = json::String( "Constrained String" );
        schema[ ts ][0]["<key>"][ "constraints" ] = json::String( Key::GetConstrainedStringConstraintKey() );
        schema[ ts ][0]["<key>"][ "description" ] = json::String( Key::GetConstrainedStringDescriptionKey() );
        schema[ ts ][0]["<value>"] = json::Object();
        schema[ ts ][0]["<value>"][ "type" ] = json::String( "String" );
        schema[ ts ][0]["<value>"][ "constraints" ] = json::String( Key::GetConstrainedStringConstraintValue()  );
        schema[ ts ][0]["<value>"][ "description" ] = json::String( Key::GetConstrainedStringDescriptionValue() );
        return schema;
    }
Ejemplo n.º 2
0
 json::QuickBuilder
 InputEIRConfig::GetSchema()
 {
     json::QuickBuilder schema( GetSchemaBase() );
     auto tn = JsonConfigurable::_typename_label();
     auto ts = JsonConfigurable::_typeschema_label();
     schema[ tn ] = json::String( "idmType:InputEIRConfig" );
 
     schema[ts] = json::Array();
     schema[ts][0] = json::Object();
     schema[ts][0][ "type" ] = json::String( "float" );
     schema[ts][0][ "min" ] = json::Number( 0 );
     schema[ts][0][ "max" ] = json::Number( 1000.0f );
     schema[ts][0][ "description" ] = json::String( IE_Monthly_EIR_DESC_TEXT );
     return schema;
 }
 json::QuickBuilder
 CoverageByNodeJson::GetSchema()
 {
     json::QuickBuilder schema( GetSchemaBase() );
     auto tn = JsonConfigurable::_typename_label();
     auto ts = JsonConfigurable::_typeschema_label();
     schema[ tn ] = json::String( "idmType:CoverageByNode" );
     schema[ ts ] = json::Array();
     schema[ ts ][0] = json::Array();
     schema[ ts ][0][0] = json::Object();
     schema[ ts ][0][0][ "description" ] = json::String( "Node Id" );
     schema[ ts ][0][0][ "type" ] = json::String( "integer" );
     schema[ ts ][0][0][ "min" ] = json::Number( 0 );
     schema[ ts ][0][0][ "max" ] = json::Number( 999999 );
     schema[ ts ][0][1] = json::Object();
     schema[ ts ][0][1][ "description" ] = json::String( "Coverage" );
     schema[ ts ][0][1][ "type" ] = json::String( "float" );
     schema[ ts ][0][1][ "min" ] = json::Number( 0 );
     schema[ ts ][0][1][ "max" ] = json::Number( 1 );
     return schema;
 }