Forum Discussion

shikhashah's avatar
shikhashah
New Member
8 months ago

Swagger Open API - Style Simple not working when objects added in Path variables

Hi, I am using swagger request validator library (version 2.22.0) in my project with below yaml configurations.

info:
  title: Sample API
  version: 1.0.0
openapi: 3.0.0
paths:
  /demo/{groupIdentifier}:
    get:
      description: This API which will provide all the members of a group.
      operationId: get-group-v2
      responses:
        "200":
          description: Successful response
    parameters:
    - description: Composite group identifier
      explode: false
      in: path
      name: groupIdentifier
      required: true
      allowReserved: true
      schema:
        properties:
          domainCode:
            description: Code of the master data domain
            type: string
          groupTypeCode:
            description: The prototype type of the group that has to be searched
            type: string
        type: object
      style: simple


running api gives me below error : 
{ "fault": { "faultstring": "OASValidation MAM-SpecValidation with resource "oas://openapi.yaml": failed with reason: "[ERROR - Unable to parse JSON - Unrecognized token 'domainCode': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false')\n\t at [Source: (String)"domainCode,CUSTOMER,groupTypeCode,CUSTOMER_GROUP"; line: 1, column: 11].: []]"", "detail": { "errorcode": "steps.oasvalidation.Failed" } } }

in the api call, I am passing path variables in object format (comma seperated) as mentioned in the doc - https://swagger.io/docs/specification/serialization/

ex. http://test.com/demo/domainCode,CUSTOMER,groupTypeCode,CUSTOMER_GROUP

Also, I debugged the library and found that its trying to convert comma-seperated values in json and hence, giving this error. can anyone please suggest whats wrong with the yaml configuration here ?

No RepliesBe the first to reply