string replacement, better exception names

This commit is contained in:
Wolfgang Hottgenroth
2021-12-15 14:58:24 +01:00
parent 7b039b4fa4
commit 0f4c509b13
5 changed files with 90 additions and 22 deletions

View File

@ -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