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 [email protected].
For more options, visit https://groups.google.com/d/optout.