-
Notifications
You must be signed in to change notification settings - Fork 9.2k
Description
This follows a comment on issue #647.
It would be great to be able to mount API specs onto another spec for service composition.
As an example, I have two independent services A and B, both having their own OAS files. I would like to 'merge' A and B together into a single, centralized spec.
If both services have, say, a /resource endpoint, I would like to discriminate them by prefixing their paths with the name of the services, /A and /B respectively (resulting in /A/resource and /B/resource).
One naive solution would be to list and redefine each path in the root OAS file and $ref the related A or B content, but changing the design of either A or B would require updating the root OAS file.
A possible alternative would be to support path nesting (discarded here):
paths:
'/A':
'/resource':
get:
# ....
'/B':
'/resource':
get:
# ....
I suggest considering introducing a mount field under Path Item Objects and taking a Paths Object:
paths:
'/A':
mount:
$ref: 'A.yaml#/paths'
'/B':
mount:
$ref: 'B.yaml#/paths'