0

I am having a problem with the path. The error that i am getting is the following check image below. I tried with the link that was pointed out by a community member @Helen Paths and no luck. Please help me out. Thanks, Darko

  /opportunity/{opportunityid}/oppproduct/{oppproductid}:
get:
  tags:
  - "Opportunity"
  summary: "Get opp product id for certain opportunity"
  description: "This endpoint displays opp product details"
  produces:
  - "application/json"
  parameters:
  - name: "opportunityid"
    in: "path"
    description: "This is unique identifier of specific opportunity"
    required: true
    type: "string"
  - name: "oppproductid"
    in: "path"
    description: "This is unique identifier of specific opp product in specific opportunity "
    required: true
    type: "string"
  responses:
    200:
      description: "successful operation"
      schema:
        type: "array"
        items:
          $ref: "#/definitions/opportunity"
    400:
      description: "Invalid status value"
put:
  tags:
  - "Opportunity"
  summary: "Update opportunity product from specific opportunity"
  description: "Update this opportunity product."
  operationId: "updateOppProduct"
  produces:
  - "application/json"
  parameters:
  - name: "opportunityid"
    in: "path"
    description: "Opportunity product with id that need to be updated"
    required: true
    type: "string"
  responses:
    400:
      description: "Invalid Opportunity product supplied"
    404:
      description: "Opportunity product not found"

error that i am getting. enter image description here

Darko Todorovski
  • 173
  • 1
  • 10

1 Answers1

1

1) "Duplicated mapping key" error indicates you have duplicate keys in one of the parameters, specifically two name keys. You only need one name:

      parameters:
      - name: "opportunityid"  # <---------
        in: "path"
        description: "Opportunity product with id that need to be updated"
        required: true
        type: "string"
        name: "oppproductid"  # <---------

2) The other error is caused by the schema keyword in a path parameter:

  - in: "path"
    description: "Updated Opp product object"
    type: "string"   # <--- This is the correct way to specify the param type in OAS 2.0
    required: true
    schema:    # <--------- Remove this
        type: integer

You don't need schema here. In OpenAPI 2.0, path, query and header parameters use type directly without the schema keyword.

Helen
  • 87,344
  • 17
  • 243
  • 314
  • Hi @Helen if i remove this i am getting additional error. Check the update. – Darko Todorovski Jul 24 '18 at 11:16
  • @DarkoTodorovski the new error is the same as in your [previous question](https://stackoverflow.com/q/51487027/113116). Can you figure out from there? – Helen Jul 24 '18 at 11:57