string replacement, better exception names
This commit is contained in:
11
generate.py
11
generate.py
@ -77,6 +77,7 @@ statementChecker = {
|
||||
'post': re.compile('^insert', re.IGNORECASE)
|
||||
}
|
||||
databaseTagFinder = re.compile('DATABASETAGBEGIN(\s+)(\S+)(\s+)DATABASETAGEND', flags=re.DOTALL)
|
||||
bindingHintFinder = re.compile('BINDINGHINTBEGIN(\s+)(\S+)(\s+)BINDINGHINTEND', flags=re.DOTALL)
|
||||
|
||||
operations = []
|
||||
for path in apiDefinition['paths'].values():
|
||||
@ -95,6 +96,7 @@ for path in apiDefinition['paths'].values():
|
||||
print(f"{resultType=}")
|
||||
description = None
|
||||
statement = None
|
||||
bindingByStringReplacement = False
|
||||
if 'description' in operation:
|
||||
description = operation['description']
|
||||
print(f"{description=}")
|
||||
@ -112,6 +114,12 @@ for path in apiDefinition['paths'].values():
|
||||
print(f"{databaseTag=}")
|
||||
else:
|
||||
print("no databasetag")
|
||||
bindingHintFinderResult = bindingHintFinder.search(description)
|
||||
if bindingHintFinderResult:
|
||||
bindingHint = bindingHintFinderResult.group(2)
|
||||
print(f"{bindingHint=}")
|
||||
bindingByStringReplacement = bindingHint == 'stringreplacement'
|
||||
print(f"{bindingByStringReplacement=}")
|
||||
|
||||
bodyInputType = {}
|
||||
if 'requestBody' in operation:
|
||||
@ -143,7 +151,8 @@ for path in apiDefinition['paths'].values():
|
||||
'statement': statement,
|
||||
'databaseTag': databaseTag,
|
||||
'bodyInputType': bodyInputType,
|
||||
'paramInputTypes': paramInputTypes
|
||||
'paramInputTypes': paramInputTypes,
|
||||
'bindingByStringReplacement': bindingByStringReplacement
|
||||
})
|
||||
print(f"{operations=}")
|
||||
apiDefinition["operations"] = operations
|
||||
|
Reference in New Issue
Block a user