Import resources into Code Repositories

The Resource Imports sidebar in Code Repositories offers a centralized interface to manage imported Foundry resources within your TypeScript Functions repository. The sidebar allows you to import, remove, and view details of various resources, including Ontology types, LMS language models, live deployments, and external systems such as REST APIs.

Resource Imports sidebar

Select an Ontology

An Ontology is required to import object and link types. To choose an Ontology:

  1. Choose Add to open the resource selector menu, and then choose Ontology to begin importing Ontology types. If no Ontology is selected, this will automatically open the Ontology selector dialog.

If you have already imported at least one Ontology type, that type's Ontology is automatically selected. To change the Ontology, choose the Edit button next to the selected Ontology's name to open the Ontology selector dialog.

Ontology selector dialog

All imported resources within your repository must be associated with the same Ontology. Note that importing resources after changing the Ontology will overwrite any existing imports from other Ontologies.

Import resources

To import resources using the sidebar:

  1. Use the Add button in the top right of the sidebar and select the desired resource type. This will open the selector dialog for that resource.
  2. Use the search bar and filters to locate the resources you want to import.
  3. Choose a resource to display its preview panel with detailed information.
  4. Use the Select button to add resources to your selection.
  5. Expand the cart panel to review your selection and confirm by choosing Confirm selection.

After confirming your selection, Code Assist will be restarted to re-run the necessary code generation tasks to apply your changes.

Example resource selector dialog

Learn more about importing resources of a specific type:

Manage imported resources

Resources are categorized by type in the sidebar:

  • Ontology: Object and link types
  • Models: LMS models and live deployments
  • Sources: External systems such as REST APIs

Choose the corresponding resource icon at the top of the sidebar to filter by type or use the text input to search by name. To remove a resource, hover over the resource icon and choose the Remove button. To add or remove multiple resources simultaneously, use a selector dialog. To view more details, select an imported resource to open its preview panel.

Some resource types may have dependencies between other resources. For instance, link types are organized under their respective object types. If an imported resource has dependencies, a message like "(1 link type)" will be displayed next to the resource title. To view a resource's dependencies, hover over the resource icon and select the chevron that appears.

Resource Imports sidebar filter controls

Importing resources without API names

Resources must have an API name to be referenced within code in TypeScript Functions repositories. If a resource lacks an API name, a warning is displayed. Hover over the warning sign to learn more or easily configure an API name by choosing Add API name. Alternatively, choose Learn more to see documentation about adding an API name tailored to the specific resource type.

Resource Imports sidebar API name warning

Enable resource types

By default, some resource types may not be enabled for use in your repository. The enabled resource types are determined by your functions.json file. This is the contents of a typical default functions.json file.

Copied!
1 2 3 4 5 6 7 8 9 10 11 12 13 { "useOntologyApiNames" : true, "enableModelFunctions" : false, "enableModelGraphFunctions" : false, "enableDiscoverImproperOntologyAccess": false, "enableQueries": false, "enableModelMetadata": false, "useDeploymentApiNames": true, "enableVectorProperties": true, "enableTimeSeriesProperties": false, "enableExternalSystems": false, "enableMediaReferenceProperties": false }

Importing resources without enabling the corresponding flag in your functions.json file may cause checks to fail in your repository. To use imported live deployments, set enableModelFunctions to true. To use imported sources, set enableExternalSystems to true.