Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Jira Legacy
serverSystem Jira
columnIdsissuekey,summary,issuetype,created,updated,duedate,assignee,reporter,priority,status,resolution
columnskey,summary,type,created,updated,due,assignee,reporter,priority,status,resolution
serverId4733707d-2057-3a0f-ae5e-4fd8aff50176
keyCPS-774

Table of Contents

Issues and Decisions

#Issue


1API Generation method in DMI-Plugin


2Backward compatibility <object> v. <String> in REST Interfaces




What Is OpenAPI?

OpenAPI Specification (formerly Swagger Specification) is an API description format for REST APIs. An OpenAPI file allows you to describe your entire API, including:

...

You can add examples to parameters, properties and objects to make OpenAPI specification of your web service clearer. Examples can be read by tools and libraries that process your API in some way. To specify an example, you use the example or examples keys.

Request and Response Body Examples

Here is an example in a request body:

requestBody:
required: true
content:
application/json:
schema:
type: string
examples:
dataSample:
value:
test:bookstore:
bookstore-name: Chapters
categories:
- code: 01
name: SciFi
- code: 02
name: kids

All request and response body examples in CPS will be added at the object level.

...

components:
examples:
dataSample:
value:
test:bookstore:
bookstore-name: Chapters
categories:
- code: 01
name: SciFi
- code: 02
name: kids
summary: A sample data

Sample response using examples defined in components:

responses:
'200':
description: OK
content:
application/json:
schema:
type: object
example:
         $ref: 'components.yml#/components/examples/dataSample'


Sample request using examples defined in components:

requestBody:
required: true
content:
application/json:
schema:
type: string
examples:
       dataSample:
$ref: 'components.yml#/components/examples/dataSample'

...

S. NoSummaryCurrent codeExpected code
1Changing the schema type in openapi.
content:
application/json:
schema:
type: string
content:
application/json:
schema:
type: object
2

Changes in Controller

Changing the datatype to Object

public ResponseEntity<String> createNode
(_, _, final String jsonData, _, _) {
public ResponseEntity<String> createNode
(_, _, final Object jsonData, _, _) {

Converting jsonData to String while passing the data to service layer
cpsDataService.saveData(dataspaceName, anchorName, jsonData,
toOffsetDateTime(observedTimestamp));
cpsDataService.saveData(dataspaceName, anchorName, jsonData.toString(),
toOffsetDateTime(observedTimestamp));

...