Definition file annotations

You can use the following annotations to customize your definition file.

Preserving the name of data types and attributes during import

You can control whether data type and attribute names are automatically adapted or preserved in their original form using specific annotations.

Table 1. Available annotations
Annotation Purpose
x-ibm-decision-adapt-type-name When set to false, preserves the original data type name.
x-ibm-decision-adapt-property-name When set to false, preserves the original attribute name.

Consider the following example:

"RadioNetworkControllerRole": {
    "x-ibm-decision-adapt-type-name" : false,
    "x-ibm-decision-adapt-property-name" : false,
    "enum": [
      "D_NRC",
      "S_NRC"
    ],
    "type": "string"
  }
  • Without x-ibm-decision-adapt-type-name set to false, the data type name RadioNetworkControllerRole would be automatically adapted to radio network controller role during import.
  • Without x-ibm-decision-adapt-property-name set to false, the enum values D_NRC and S_NRC would be adapted to D NRC and S NRC during import.

By setting both annotations to false, the original names are preserved exactly as defined:

  • Data type: RadioNetworkControllerRole
  • Attributes: D_NRC, S_NRC

Sharing data types between schemas

When importing schemas that contain identically named types into different data models, conflicts can occur. Types with the same name but created in different packages are treated as distinct types, even if they have identical verbalizations. For example, if you import a schema that contains the type Person in data model 1, and another schema that contains the same type Person in data model 2, you cannot use both data models at the same time.

You can use the x-ibm-pattern-to-package annotation to specify a shared package for common types across schemas. The following example shows the x-ibm-pattern-to-package used in an OpenAPI schema:
{
  "openapi": "3.0.3",
  "x-ibm-pattern-to-package" : {
     "^Shared.*$" : "com.shared"
},

The x-ibm-pattern-to-package annotation must be put at the top level. It can contain several regular expressions and relate them to a package name. Here, all types that begin with Shared in the schema is put in the com.shared package.

Apply the same x-ibm-pattern-to-package annotation to all the schemas that contain the types to be shared. Each time a schema is imported, the shared types are created in the shared packages.