My FNZ Studio Version

Extensions

Latest Update: 22.11.2024 | Margherita Taffarel,
Documentation
2023

The OpenApi Extension provides functionalities to import and export OpenAPI specification files.

1 Export

The Export functionality provides a Business Object exporter that can be used to generate the OpenAPI Specification of a given Web API.

Note the following:

  • Schemas names are mapped from Data Class names. Package names are not exported.
  • If a Web API Business Object references Data Classes with the same name from different Packages, the export will fail.
  • Multiple inheritance in Data Classes should be avoided because auto-generated clients might not support multiple inheritance (e.g., Java clients).

2 Import

The OpenAPI Import functionality can be used to automatically generate Business Objects such as Packages and Data Classes from a given OpenAPI Specification. The import functionality can be used as follows:

  1. OpenApi:GenerateDataClasses Script Function
  2. OpenAPI Importer module in FNZ Studio Composition (Data&Integration tab).
    Note that you need Packages Permission (Full-Access level) to use the OpenAPI Importer feature.

2.1 Script Function

The OpenApi:GenerateDataClasses($packageId, $location) Scrip Function generates the data model from a given OpenAPI specification. It has the following parameters:

  • packageId — Package where the Data Classes will be generated. If the provided packageId does not exist, a new Package is created.
  • location — Location of the OpenAPI specification. It can be an absolute file path, a relative file path to the data-home, or a public URL. For relative paths, the {DATA_HOME} placeholder can be used as prefix e.g., {DATA_HOME}/work/tmp/simpleSpec.json.

2.2 OpenAPI Importer

The OpenAPI Importer is an FNZ Studio Wizard that can be accessed under Data & Integation > OpenAPI > OpenAPI Importer. The wizard is split in multiple steps that allow importing an OpenAPI specification file and generate the data model automatically.

2.2.1 Generated Data Classes

Note the following details about the Data Classes generated using the OpenAPI import functionality:

  • If a schema name provided contains a . (dot), this is replaced with an empty string.
  • Schemas representing dates could be mapped to a Date or a String based on the extension property (System Configuration > Extensions > [Extension]> Edit Configuration) openapi.importer.map.date2string. Default is Date.
  • Schemas representing money could be mapped to the Primitive Type Money based on the extension property openapi.importer.map.money2primitive. Default is false.

All generated Data Classes are enriched with following metadata:

  • Generator — Name of the generating extension (e.g., OpenApi).
  • Adapter-Version — Version of the generating extension (e.g., 2.0.0-dev).
  • OpenApi-SpecVersion — OpenAPI specification version (e.g., 3.0.1).
  • OpenApi-ApiVersion — API version (e.g., 1.0).
  • OpenApi-ClusterFilePath — Path to the Cluster File where the imported OpenAPI specification file is stored (e.g., openapi/OpenApiSpec.json/n11676977603348)

Data Class Generator does not support nested collections or nested maps or a mixed solution (e.g., a map of collections). In this case the nested type would be of type Any.
Data Class Generator supports:

  • Primitive types as follows: Integer, String, Boolean, Long, Float, Double, Date, Money
  • Indexed and Named Collections
  • Inheritance
  • Enumerations

ClusterFile and LocalFile will not be mapped as a primitive type but rather as regular Data Classes.
Other types that do not fit in the FNZ Studio Primitive Types or Data Class will be imported as type Any.

Enumerations Support

Currently, only String enumerations are supported. These can be defined in the following ways:

  • Standard definition at schema level:
    "schemas": {
      "Color": {
        "type": "string",
        "enum": [
          "black",
          "white",
          "red"
        ]
      },
      "Marker": {
        "type": "object",
        "properties": {
          "color": {
            "$ref": "#/components/schemas/Color"
          }
        }
      }
    }
  • Standard definition at schema level using x-enumNames extension:
    "schemas": {
      "Color": {
        "type": "string",
        "x-enumNames": [
          "blackName",
          "whiteName",
          "redName"
        ],
        "enum": [
          "black",
          "white",
          "red"
        ]
      }
    }
  • Inline definition at property level:
    "schemas": {
      "Marker": {
        "type": "object",
        "properties": {
          "color": {
            "type": "string",
            "enum": [
              "black",
              "white",
              "red"
            ]
          }
        }
      }
    }
  • Inline definition at property level using x-extensible-enum extension:
    "schemas": {
      "Marker": {
        "type": "object",
        "properties": {
          "color": {
            "type": "string",
            "x-extensible-enum": [
              "red",
              "blue",
              "green"
            ]
          }
        }
      }
    }

Supported enums will be mapped to Data Classes with static functions returning each enum's values. The ids of such Data Classes have Enum as a suffix (e.g., ColorEnum). In the case of inline definition at property level, the parent container name is added as a prefix (e.g., MarkerColorEnum).

Based on the last definition example we will have the following mapping:

    MarkerColorEnum
      static function RED   -> return "red"
      static function BLUE  -> return "blue"
      static function GREEN -> return "green"

    Marker
      property color -> with type "String" and description "related to package:MarkerColorEnum" 

In case of unsupported enums, we will have a mapping such as:

    Marker
      property color -> with type "Any" and description "related to a non-mappable Enum" 
© 2026 Appway AG. All Rights Reserved