JSON References cannot be extended – see 
https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#referenceObject.

 

Currently, the editor for 3.0.0 does not show semantic errors, so it’s not 
covered by it. Technically, it’s not an error, it’s just meaningless (and we 
show it as a warning).

 

 

 

From: <swagger-swaggersocket@googlegroups.com> on behalf of Andy Schmidt 
<argos.netwo...@gmail.com>
Reply-To: "swagger-swaggersocket@googlegroups.com" 
<swagger-swaggersocket@googlegroups.com>
Date: Friday, November 10, 2017 at 09:14
To: Swagger <swagger-swaggersocket@googlegroups.com>
Subject: Swagger UI - attempt to "extend" referenced/reused path object with 
additional parameter

 

Hi, 

 

It's possible I'm doing something unsupported - but at least the Swagger.io 
Editor does not REJECT it as being formally wrong. However, the Swagger.io UI 
seems to get confused.

 

In the example below, with the yellow "$ref" commented out, the UI will show 
the two distinct paths as expected.

 

However, when I make the $ref active (attempting to reuse the /sources/{uid} 
definition as "least common denominator", and extend it with additional 
(non-conflicting) parameter from /source/{neighbors}_{uid}), the result in the 
UI is rather unexpected:
The first path suddenly has the parameter from the SECOND path?
openopenapi: "3.0.0"
info:
  version: 1.0.0
  title: Test
servers:
  - url: http://api.test.com/v1
paths:
  /sources/{uid}:
    get:
      summary: Retrieve one individual Source object.
      parameters:
        - $ref: "#/components/parameters/Path_uid"
      responses:
        default:
          description: Default Response
  /sources/{neighbor}_{uid}:
#   $ref: "#/paths/~1sources~1{uid}"
    get:
      summary: Retrieve the neighbor of one individual Source object.
      parameters:
        - $ref: "#/components/parameters/Path_neighbor"
      responses:
        '200': # OK
          description: Test Response
components:
  parameters:
    Path_uid:
      name: uid
      in: path
      description: The unique ID of the object to be accessed, or "first" or 
"last".
      required: true
      schema:
        oneOf: 
        - type: integer
        - type: string
          enum: [first, last]
    Path_neighbor:
      name: neighbor
      in: path
      description: The direction, either "before" or "after", relative to the 
unique ID.
      required: true
      schema:
        type: string
        enum: [before,after]

 

-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to swagger-swaggersocket+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to swagger-swaggersocket+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to