Reference parameters/components from another OpenAPI json (same project)
Originally posted by user Luca P. to the Stoplight Community on 05/18/2023 at 13:18 ET.
I have multiple OpenAPI JSON files in the same project, let's call them A.json and B.json. In A there are a few parameters defined in #/components/parameters. I've just found out, while editing in "Form" mode the parameters of an API in B, that the picker allows to select A's parameters (selecting "This project" in the dropdown), with an extended reference as ./A.json#/components/parameters/my_parameter.
First question: is this an intended behavior?
Second: I tried the same trick with models and responses, but both pickers don't show any definitions from A ("This project" is selected). But, switching from "Form" to "Code" mode, and entering manually the exact $ref path (e.g. ./A.json#/components/schemas/my_model), everything seems to work without issues.
In general, are cross-file references allowed?
a_welch (Staff) [05/19/2023 - 10:33 ET]
Global components are coming as part of Component Libraries. and once released they will be accessible via the form view as well as the code view. To start learning more about Component Libraries check out the documentation here. https://meta.stoplight.io/docs/platform/sovfvcspumw1d-component-libraries