Swift codegen: add predicate properties

Properties marked with `predicate` in the schema are now accepted.

* in the dbscheme, they will translate to a table with a single `id`
  column (and the table name will not be pluralized)
* in C++ classes, they will translate to `bool` fields
* in QL classes, they will translate to predicates

Closes https://github.com/github/codeql-c-team/issues/1016
This commit is contained in:
Paolo Tranquilli
2022-05-09 17:50:49 +02:00
parent effa9ee207
commit c08e6fdc1e
17 changed files with 179 additions and 60 deletions

View File

@@ -35,6 +35,7 @@ class Field:
type: str
is_optional: bool = False
is_repeated: bool = False
is_predicate: bool = False
trap_name: str = None
first: bool = False
@@ -61,7 +62,7 @@ class Field:
@property
def is_single(self):
return not (self.is_optional or self.is_repeated)
return not (self.is_optional or self.is_repeated or self.is_predicate)