Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for returning simple array of input/output variable names from modelSpec #494

Closed
chrispcampbell opened this issue Jun 5, 2024 · 1 comment · Fixed by #495 or #476
Closed

Comments

@chrispcampbell
Copy link
Contributor

chrispcampbell commented Jun 5, 2024

Currently the UserConfig.modelSpec function is expected to return full InputSpec[] and OutputSpec[] arrays.

The InputSpec interface in particular has some required properties (defaultValue, minValue, maxValue) that are not strictly needed when generating a model, and are only provided for use by other plugins (specifically plugin-check, for the purposes of building a default model-check bundle that is capable of setting inputs to their default, min, and max values.

The OutputSpec interface currently only contains a single property, varName.

For projects (like some simple example apps) that aren't using plugin-config or plugin-check, it's inconvenient to have to provide full InputSpec and OutputSpec instances. For these simple cases, it would be sufficient to provide an array of input and output variable names.

I will change the ModelSpec type as follows:
image

The following diff shows how this change will simplify the config file for the new house-game example:
image

@chrispcampbell
Copy link
Contributor Author

As part of this, I made a few small changes to the build package APIs (which should have no impact on existing projects or plugins):

  • Added ResolvedModelSpec interface; we now pass a ResolvedModelSpec to the plugin callback functions instead of a plain ModelSpec.

  • Changed the InputSpec interface to make the defaultValue, minValue, and maxValue properties optional.

  • Changed the ModelSpec interface to make the datFiles property optional (this no longer needs to be specified for projects that don't use dat files).

Also, one small behavior change to the plugin-check package:

  • The default bundle template will skip inputs that don't have the defaultValue, minValue, or maxValue properties set in the InputSpec and will warn the user. This shouldn't happen too much because most projects will provide these values (i.e., via plugin-config).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment