data extraction from openapi defintion
This commit is contained in:
@ -17,18 +17,51 @@ namespace ${env['packagename']}.Implementations
|
||||
public class RegularApiImplementation : RegularApiController
|
||||
{
|
||||
#for $operation in $operations
|
||||
public override IActionResult ${operation['func']}() {
|
||||
return new ObjectResult();
|
||||
#if $operation['method'] == 'get'
|
||||
public override IActionResult ${operation['func']}( #slurp
|
||||
#if $operation['byIdSelector']
|
||||
INSERT CODE TO GET ID #slurp
|
||||
#elif $operation['inputType']
|
||||
[FromBody]$operation['inputType']['csName'] inputItem #slurp
|
||||
#end if
|
||||
) {
|
||||
// Statement:
|
||||
#if not $operation['statement']
|
||||
// SELECT
|
||||
#set $sep = ""
|
||||
#for $property in $types[$operation['resultType']['apiName']]['properties']
|
||||
// $sep$property['sqlName']
|
||||
#set $sep = ","
|
||||
#end for
|
||||
// FROM $types[$operation['resultType']['apiName']]['sqlName'];
|
||||
#else
|
||||
// $operation['statement']
|
||||
#end if
|
||||
#if $operation['inputType']
|
||||
// Input type mapping: $operation['inputType']['apiName'] -> $operation['inputType']['csName']
|
||||
#for $property in $types[$operation['inputType']['apiName']]['properties']
|
||||
// $property['sqlName'] -> $property['csName']
|
||||
#end for
|
||||
#end if
|
||||
// Model object to use: $operation['resultType']['apiName'] -> $operation['resultType']['csName']
|
||||
// Properties to map result:
|
||||
#for $property in $types[$operation['resultType']['apiName']]['properties']
|
||||
// $property['sqlName'] -> $property['csName']
|
||||
#end for
|
||||
#if $operation['isList']
|
||||
// result must be mapped in list
|
||||
#end if
|
||||
return new ObjectResult();
|
||||
}
|
||||
|
||||
#elif $operation['method'] == 'post'
|
||||
bla
|
||||
|
||||
#else
|
||||
#raise Exception('invalid method')
|
||||
#end if
|
||||
|
||||
#end for
|
||||
|
||||
public override IActionResult CyclesStartCycle([FromBody]MCycle mCycle) {
|
||||
return StatusCode(200, default(MCycle));
|
||||
}
|
||||
|
||||
public override IActionResult CyclesStopCycle([FromBody]CycleId cycleId) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user