Table of Contents

Search

  1. Preface
  2. Introduction to REST V2 Connector
  3. Connections for REST V2
  4. REST V2 operations
  5. Mappings and mapping tasks with REST V2 Connector
  6. Swagger File Generation
  7. Appendix A: Swagger objects
  8. OpenAPI objects

REST V2 Connector

REST V2 Connector

Array of objects

Array of objects

You can define an array of objects for
application/json
media type in the OpenAPI specification file in the request and response definitions.

Inline array in the request and response body

The requestBody or response where all the fields of the request body are defined in the
requestBody
section.
For example,
"/users_inline": { "post": { "description": "Add Multiple Users", "operationId": "users_inline", "requestBody": { "description": "Add Multiple Users", "content": { "application/json": { "schema": { "type": "array", "items": { "type": "object", "properties": { "first_name": { "type": "string" }, "last_name": { "type": "string" } } } } } } } "responses": { "200": { "description": "add User Response", "content": { "application/json": { "schema": { "type": "array", "items": { "type": "object", "properties": { "first_name": { "type": "string" }, "last_name": { "type": "string" }, "id": { "type": "string" } } } } } } } }

Inline ref array in the request and response body

The requestBody or response where the schema type is array and it contains the reference object
$ref
.
For example,
"post": { "description": "Add Multiple Users", "operationId": "users_inline_ref", "requestBody": { "description": "Add new Users", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/user" } } } } } "responses": { "200": { "description": "add User Response", "content": { "application/json": { "schema": { "type": "array", "items": { "$ref": "#/components/schemas/user" } } } } } }

Array in component in the request and response body

The requestBody or response where schema contains only the reference object
$ref
pointing to a component.
For example,
"post": { "description": "Add Multiple Users", "operationId": "users", "requestBody": { "description": "Add new Users", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/user_list_inline" } } } } "components": { "schemas": { "user_list": { "type": "array", "items": { "$ref": "#/components/schemas/user" } } } } "responses": { "200": { "description": "add User Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/user_list" } } } } } "components": { "schemas": { "user_list": { "type": "array", "items": { "$ref": "#/components/schemas/user" } } } }

Complex object in the request and response body

The requestBody or response that contains array fields along with simple fields.
For example,
"description": "Add Complex Object", "operationId": "aad_complex_object", "requestBody": { "description": "Add new Users", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/complex_object" } } } } "components": { "schemas": { "complex_object": { "type": "object", "properties": { "sample_string": { "type": "string" }, "user_array": { "type": "array", "items": { "$ref": "#/components/schemas/user" } } } } } } "responses": { "200": { "description": "add User Response", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/complex_object" } } } } } "components": { "schemas": { "complex_object": { "type": "object", "properties": { "sample_string": { "type": "string" }, "user_array": { "type": "array", "items": { "$ref": "#/components/schemas/user" } } } } } }

0 COMMENTS

We’d like to hear from you!