Design > Designing Process Objects > Required and nullable elements
  

Required and nullable elements

You can define process object fields as required and nullable in the WSDL, Swagger JSON or YAML, and OpenAPI 3.0 JSON or YAML files before you import the files to generate a process object.
In a WSDL file, to define a field as nullable, set the nillable attribute to "true" in the field element. If you do not specify the nillable attribute, the field is set to not nullable by default. If you do not want to set a field as required, set the minOccurs attribute to "0" in the field element. If you do not specify the minOccurs attribute, the field is considered as required by default.
For example, consider a WSDL file that has a schema named ProcessObjectReq. The schema is of a complex type and contains two elements called as Name and ID. To set the ID field as nullable and not required, set the nillable attribute to "true" and the minOccurs attribute to "0" as shown in the following sample:
<xsd:complexType name=”ProcessObjectReq”>
<xsd:sequence>
<xsd:element name=”Name” nillable=”false” type=”xsd:string”/>
<xsd:element name=”ID” minOccurs=”0” nillable=”true” type=”xsd:integer”/>
</xsd:sequence>
</xsd:complexType>
When you import the WSDL file, the nullable and required field elements defined in the WSDL file are propagated to the process object as shown in the following image:
The image shows the required and nullable fields selection from the imported WSDL file.
Similarly, you can set the required and nullable field elements in the Swagger JSON file and create a process object as shown in the following sample:
"definitions" : {
"Process1-3Request" : {
"type" : "object",
"required" : [ "Test" ],
"properties" : {
"Test" : {
"$ref" : "#/definitions"/ProcessObjectReq"
}
}
},
"ProcessObjectReq" : {
"type" : "object",
"properties" : {
"Name" : {
"type" : "string"
},
"ID" : {
"type" : "integer",
"format" : "int32",
"x-nullable": true
}
},
"required": [
"Name"
]
}
}
You can also set the required and nullable field elements in the OpenAPI 3.0 file and create a process object as shown in the following sample:
"ApiResponse": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"format": "int32",
"required": true,
"nullable": false
},
},
...
If you use a process object with nullable fields in a process, and generate the Swagger file for the process, the generated Swagger file might not contain the x-nullable field defined in the process object. The field is set to not nullable by default. Therefore, Informatica recommends that you use a WSDL file or OpenAPI 3.0 file to preserve the nullable field values.
When you use this process object in a process, the fields marked as required and nullable use the same restrictions in the generated WSDL file, Swagger file, and OpenAPI 3.0 file.
When you import the JSON file and create a process object, all the fields are marked as nullable and not required by default.