Give explicit error if table doesn't have a primary key

This commit is contained in:
2023-06-06 11:06:57 -05:00
parent 8de9288c05
commit c5b14cd22c

View File

@ -360,6 +360,11 @@ public class GenerateOpenApiSpecAction extends AbstractQActionFunction<GenerateO
continue; continue;
} }
if(!StringUtils.hasContent(table.getPrimaryKeyField()))
{
throw (new QException("Unable to generate OpenAPI spec for table " + tableName + ", because it does not have a primary key."));
}
String tableApiName = StringUtils.hasContent(apiTableMetaData.getApiTableName()) ? apiTableMetaData.getApiTableName() : tableName; String tableApiName = StringUtils.hasContent(apiTableMetaData.getApiTableName()) ? apiTableMetaData.getApiTableName() : tableName;
String tableApiNameUcFirst = StringUtils.ucFirst(tableApiName); String tableApiNameUcFirst = StringUtils.ucFirst(tableApiName);
String tableLabel = table.getLabel(); String tableLabel = table.getLabel();