IBM webMethods Hybrid Integration

IBM webMethods Hybrid Integration

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.


#TechXchangePresenter
 View Only
Expand all | Collapse all

REST JSON wrapping issue with document (Swagger)

  • 1.  REST JSON wrapping issue with document (Swagger)

    Posted Mon November 09, 2020 03:15 AM

    I am facing an issue while generating a project in web-methods through a swagger file. The input document is created under _generated input. But when I am sending the request through postman it does not map the request with the document. Instead, it creates the elements independently. Please see the screenshots attached and let me know if there is anything that can help automatically map the elements under the object. As it is happening in the debug screen.

    I have shared both screens in the attachment.

    1

    Designer Version 10.3
    Webmehtod:10.3.0.0


    #API-Management
    #webMethods
    #API-Gateway


  • 2.  RE: REST JSON wrapping issue with document (Swagger)

    Posted Mon November 09, 2020 04:35 AM

    Hi Ulhaq,

    Have you applied latest fixes on your 10.3 Integration Server version? If yes which ones? Could you attach the swagger file and also the request that you sent from postman?

    Regards,
    Aishvarya


    #API-Management
    #webMethods
    #API-Gateway


  • 3.  RE: REST JSON wrapping issue with document (Swagger)

    Posted Mon November 09, 2020 05:47 AM

    the last fixed is shown as IS_10.3_core_fix7 and the issue is with all the swagger files.

    swagger: '2.0'
    info:
    description:  Notification
    version: '1.0'
    title: notifcation
    termsOfService: 'http://swagger.io/terms/'
    contact:
    email: apiteam@swagger.io
    license:
    name: Apache 2.0
    url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
    host: 'abaclocalhost:5555'
    basePath: /gateway/ss/1.0
    schemes:
    - http
    paths:
    /Notification:
    post:
    summary: send  notification
    description: ''
    operationId: sendNotification
    consumes:
    - application/json
    - application/xml
    produces:
    - application/json
    parameters:
    - in: body
    name: body
    required: false
    schema:
    $ref: '#/definitions/NotificationRequest'
    responses:
    '200':
    description: sucessfull response
    schema:
    $ref: '#/definitions/NotificationResponse'
    '400':
    description: Bad request. User ID must be an integer and larger than 0.
    '401':
    description: Authorization information is missing or invalid.
    '404':
    description: A user with the specified ID was not found.
    '405':
    description: Invalid input
    definitions:
    ApplicationStatus:
    type: object
    properties:
    code:
    type: string
    descriptionAR:
    type: string
    descriptionEN:
    type: string
    id:
    type: integer
    format: int64
    xml:
    name: applicationStatus
    NotificationResponse:
    type: object
    properties:
    status:
    type: string
    transactionId:
    type: string
    NotificationType:
    type: object
    properties:
    code:
    type: string
    descriptionAR:
    type: string
    descriptionEN:
    type: string
    id:
    type: integer
    format: int64
    xml:
    name: NotificationType
    ApplicationType:
    type: object
    properties:
    code:
    type: string
    descriptionAR:
    type: string
    descriptionEN:
    type: string
    id:
    type: integer
    format: int64
    xml:
    name: ApplicationType
    ApiResponse:
    type: object
    properties:
    status:
    type: string
    transactionId:
    type: string
    NotificationCategory:
    type: object
    properties:
    code:
    type: string
    descriptionAR:
    type: string
    descriptionEN:
    type: string
    id:
    type: integer
    format: int64
    xml:
    name: NotificationCategory
    NotificationRequest:
    type: object
    properties:
    
    applicationStatus:
    $ref: '#/definitions/ApplicationStatus'
    
    notificationType:
    $ref: '#/definitions/NotificationType'
    xml:
    name: NotificationRequest
    externalDocs:
    description: Find out more about Swagger
    url: 'http://swagger.io'
    
    
    
    

    sample JSON

    {
    "applicationStatus": {
    "code": "string",
    "descriptionAR": "string",
    "descriptionEN": "string",
    "id": 0
    },
    "notificationType": {
    "code": "string",
    "descriptionAR": "string",
    "descriptionEN": "string",
    "id": 0
    }
    }
    
    
    

    I have noticed that sub-object are coming separately some values are going inside _generated. AS per the screenshot.

    3


    #webMethods
    #API-Management
    #API-Gateway


  • 4.  RE: REST JSON wrapping issue with document (Swagger)

    Posted Wed November 11, 2020 01:03 AM

    Hi Ulhaq,
    Seems this was a bug and with the latest fix, it is resolved. You can try with latest fix.

    Regards,
    Aishvarya


    #API-Gateway
    #API-Management
    #webMethods


  • 5.  RE: REST JSON wrapping issue with document (Swagger)

    Posted Thu November 12, 2020 04:13 PM

    Hi Aishvarya,

    Can you please mention the latest fix number applicable for v10.3 Core and it would be useful here!. :slightly_smiling_face:

    TIA,
    RMG


    #API-Gateway
    #webMethods
    #API-Management


  • 6.  RE: REST JSON wrapping issue with document (Swagger)

    Posted Sun November 15, 2020 11:25 AM

    Right, Could you please tell which is the latest fix available in which this bug was fixed, Most probably it is related to swagger import?


    #API-Gateway
    #webMethods
    #API-Management


  • 7.  RE: REST JSON wrapping issue with document (Swagger)

    Posted Tue November 17, 2020 12:35 AM

    IS_10.3_Core_Fix13 is the latest fix.


    #API-Gateway
    #webMethods
    #API-Management


  • 8.  RE: REST JSON wrapping issue with document (Swagger)

    Posted Wed January 06, 2021 02:38 PM

    Thanks for sharing the latest info :slight_smile:

    @Misbah, You may please review the latest fix and apply in your Sandbox/LLE and dry run it for proofing!

    HTH,
    RMG


    #API-Management
    #API-Gateway
    #webMethods


  • 9.  RE: REST JSON wrapping issue with document (Swagger)

    Posted Fri January 22, 2021 05:23 AM

    Misbah Ulhaq, this is a problem with the swagger file. In the parameters:body insert also the atribute “name”, like:

    parameters:
    - in: body
    name: "NotificationRequest"
    name: body
    required: false
    schema:
    $ref: '#/definitions/NotificationRequest'
    

    In case of a response the document, it will be generted with the name of the shema you provide ( in your case “NotificationResponse”).


    #webMethods
    #API-Gateway
    #API-Management