When you import an OpenAPI Specification, it generates unique and valid field names for COBOL variables from the schema element names by using the following rules:
COBOL and C# reserved words are prefixed with “X-”.
Characters other than A-Z, a-z, 0-9, or hyphen are replaced with “-”.
If the first or last character is a hyphen, it is replaced with “X”.
Field names are limited to 30 characters.
If a generated name exceeds this length, by default the element name is truncated.
In the same scope, the duplicate names are made unique by adding numeric digits to the second and following instances of the name.
If an original name is normalized, actual schema name is commented in the copy book for reference.
The following table provides a description on the OpenAPI Schemas and the corresponding COBOL copy books.
OpenAPI Specification | COBOL Data Description |
---|---|
Simple Type - Path, Query, Header, Cookie, Form parameters | Supported. |
Array Schema Type - Query, Header | Supported. Default style variance not supported. |
Data type: Binary "*name*":{ "type":" binary", "format":null } | Not Supported. |
Data type: String "*name*":{ "type":"string", "format":"string" } | LEN-{NAME} PIC 9(5) – Actual Length of the string {NAME} PIC X(N) N= Max allowed string Length specified using defaults and Vendor extensions |
Data type: Date "*name*":{ "type":"string", "format":"date" } | 01 {NAME} 02 YEAR PIC 9(4). 02 MONTH PIC 9(2). 02 DAY_ PIC 9(2). |
Data type: DateTime "*name*":{ "type":"string", "format":" date-time" } | 01 {NAME} 02 YEAR PIC 9(4). 02 MONTH PIC 9(2). 02 DAY_ PIC 9(2). 02 TIME_. 03 HOUR PIC 9(2). 03 MIN PIC 9(2). 03 SEC PIC 9(2). 03 MS PIC 9(2). |
Data type: Password "*name*":{ "type":"string", "format":" password " } | LEN-{NAME} PIC 9(5) – Actual Length of the string {NAME} PIC X(N) N= Max allowed string Length specified using defaults and Vendor extensions |
Data type: Password "*name*":{ "type":"string", "format":" byte" } | LEN-{NAME} PIC 9(5) – Actual Length of the string {NAME} PIC X(N) N= Max allowed string Length specified using defaults and Vendor extensions |
Data type: Integer without format "*name*":{ "type":"integer", "format":"null" } | PIC S9(18) |
Data type: Integer and format: int32 "*name*":{ "type":"integer", "format":" int32" } | PIC S9(9) |
Data type: Integer and format: int64 "*name*":{ "type":"integer", "format":" int64" } | PIC S9(18) |
Data type: number without format "*name*":{ "type":"number ", "format":" null" } | MCP-PIC S9(18)V9(5) OS2200- PIC S9(12)V9(5) |
Data type: number and format: float "*name*":{ "type":"number ", "format":"float" } | PIC S9(9)V9(5) |
Data type: number and format: double "*name*":{ "type":"number ", "format":" double " } | MCP-PIC S9(18)V9(5) OS2200- PIC S9(12)V9(5) |
Data type: Boolean "*name*":{ "type":"Boolean", "format":"Boolean" } | PIC 9(1) |
Variable Array: "type": "array", "items": {<JSON Sub-schema>}, “x-Unisys-VariyingSizeArray”:true "maxItems": m | 01 ARRAY-COUNT PIC 9(5). 01 ARRAY OCCURS m TIMES DEPENDING ON. 02 ITEMS PIC 9(5). Use “x-Unisys-VariyingSizeArray” vendor extension to leverage DEPDENDING ON COBOL Capability. Valid values are true and false |
Array of Primitive Data type: "type": "array", "items": { "type": "integer", "format": "int32" }, "additionalItems": false, | 01 ARRAY-COUNT PIC 9(5). 01 ARRAY PIC S9(9) OCCURS m TIMES. |
Array of Complex Data type: "type": "array", "items": {<JSON Sub-schema>}, | 01 ARRAY-COUNT PIC 9(5). 01 ARRAY OCCURS m TIMES. 02 ITEM1 PIC 9(5). etc. |
Array: "maxItems": m, "minItems": n “uniqueItems": true | Not Supported. |
Enum: "*name*":{ "enum": [ "clueless", "lazy", "adventurous", "aggressive" ] } | 0X {NAME} PIC X(11). 88 CLUELESS VALUE "clueless". 88 LAZY VALUE "lazy". 88 ADVENTUROUS VALUE "adventurous". 88 AGGRESSIVE VALUE "aggressive". |
Array of enum | Not supported. It is considered as array of strings |
Body Parameter: "type": "object", "properties": { [ "<element name>":{<JSON Sub-schema>} [,] ]* } | 01 {OBJECTNAME} 02 FIELD1 PIC 9(4). 02 FIELD2 PIC 9(4). etc. |
Body Parameter JSON Schema: "maxProperties": m, "minProperties": n, "patternProperties": "dependencies": | maxProperties, minProperties, patternProperties, dependencies not supported. |
Validation Attributes: "*name*":{ "Pattern":"xx", "MinItems":"xx", "MaxItems":"xx", "MaxLength":"xx", "Required”:"xx", } | Not Supported. COBOL Copy Book contains these information. Recommending to include validation as part of |
Self-Referencing Schema “*ClassNAME*”{ "*ClassNAME*":{ "type":"number ", "format":" double " } } | Not Supported. This is a restriction on the language structure generated. |
Additional Properties: { "type": "object", "additionalProperties": { "type": "datatype" } } | Not Supported. |
Polymorphism: "allOf" "oneOf" | Supported. |
Callback Object, Link Object | Not Supported. |
Security: Basic API Key Bearer | Supported |
oAuth2 clientCredentials password | Supported |
oAuth2 Implict authorizationCode | Not supported |
OpenIDConnect | Not supported |