kota65535 / openapi-merger

Merges multiple OpenAPI document files into a single file.
MIT License
31 stars 6 forks source link

Allow for $include ($ref) Strings as values #104

Open RobertLbebber opened 1 month ago

RobertLbebber commented 1 month ago

Imagine you have terms in one file; maybe these are pseudo-environment variables, configs, or just a list of IDs and you want to import their values for the use of many varying implications. Say for a component, a parameter, a status code, whatever and you don't want the key-value association, just the value.

Right now you can do something like this:

parentKey:
    $include: "../.../commons.yaml#/IDs/ID1"

where commons.yaml is as such

IDs:
    ID1: 
        value: 1

This will render

parentKey:
    value: 1

However, if you don't want the value of 1 to always be associated with the key of value then there isn't (afaik) to decouple them beside just having something like:

IDs:
    ID1_V: 
        value: 1
    ID1_I: 
        id: 1
    ID1_P: 
        primary: 1
# etc...

Please let me know if there is already a easy decoupling way to do this.