schultek/stormberry

Unable to generate model schema with @HiddenIn(<Symbol>)

DamienLeon opened this issue · 3 comments

For the given user model, I have annotated the password to be hidden in the Base view. Now, when I generate the code, the following error is thrown which results in the schema to be not being generated.


[WARNING] stormberry:schema on lib/src/models/user_admin/user_admin.dart:
Failed to build database schema:

Column field was annotated with "HiddenIn(Symbol("Base"))", which is not supported.
  - String password

[WARNING] stormberry:schema on lib/src/models/user_admin/user_admin.dart:
#0      FieldColumnElement.checkModifiers (package:stormberry/src/builder/elements/column/field_column_element.dart:55:7)
#1      new ColumnElement (package:stormberry/src/builder/elements/column/column_element.dart:59:5)
#2      new _FieldColumnElement&ColumnElement&NamedColumnElement (package:stormberry/src/builder/elements/column/field_column_element.dart)
#3      new FieldColumnElement (package:stormberry/src/builder/elements/column/field_column_element.dart:19:9)
#4      TableElement.prepareColumns (package:stormberry/src/builder/elements/table_element.dart:110:21)
#5      SchemaState.finalize (package:stormberry/src/builder/schema.dart:38:17)
#6      SchemaState.getForAsset (package:stormberry/src/builder/schema.dart:31:5)
#7      OutputBuilder.build (package:stormberry/src/builder/builders/output_builder.dart:25:25)
<asynchronous suspension>
#8      runBuilder.buildForInput (package:build/src/generate/run_builder.dart:52:7)
<asynchronous suspension>
#9      Future.wait.<anonymous closure> (dart:async/future.dart:522:21)
<asynchronous suspension>

This is the model class for the user

@Model(views: [#Base, #DB])
abstract class UserAdmin {
  @PrimaryKey()
  @AutoIncrement()
  int get id;

  String get userName;

  @HiddenIn(#Base)
  String get password;
}

Dart SDK version: 2.19.2 (stable) on "windows_x64"
stormberry: ^0.12.1

Oh ok this is an oversight. Normal columns should also be allowed to be annotated with HiddenIn.

This is fixed now with v0.13.0.

Works like a charm. Thank you. :)