Closed vampyar closed 3 weeks ago
hi @vampyar
We created a small example using $references: https://github.com/apideck-libraries/portman/tree/main/examples/config-references, which could be helpful.
hi @thim81 Yep I got it but your example you include one ref
how I can did it like multiple time
version: 1
tests:
contractTests:
$ref: './examples/config-references/definitions/test-contracts.yaml#/contractTests'
contentTests:
$ref: './examples/config-references/definitions/test-content.yaml#/contentTests'
globals:
$ref: 'https://raw.githubusercontent.com/apideck-libraries/portman/main/examples/config-references/definitions/globals.yaml#/globals'
like example:
version: 1
tests:
contractTests:
$ref: './examples/config-references/definitions/test-contracts.yaml#/contractTests'
$ref: './examples/config-references/definitions/test-contracts1.yaml#/contractTests'
contentTests:
$ref: './examples/config-references/definitions/test-content.yaml#/contentTests'
globals:
$ref: 'https://raw.githubusercontent.com/apideck-libraries/portman/main/examples/config-references/definitions/globals.yaml#/globals'
hi @vampyar, it depends on how your file with the refs is structured.
It should work in your very first example if #/overwrites is an object and not an array. So you cannot include multiple $refs containing arrays, but with objects on a lower level it will work.
With a json config, it works for me like this by just including the $ref on the object level.
{
"variationTests": [
{
...
},
{
"$ref": "portman-variation-tests.json#/variationTestsUnauthorized"
}
]
}
With the portman-variation-tests.json containing objects:
{
"variationTestsUnauthorized": {
"openApiOperation": "*::/*",
"openApiResponse": "401",
"variations": [...]
}
}
How I can using separate file and merge in the one file for overwrites field ?
in the case I got error
I need split this entity on the two file or more, and after combine to one in the overwrite or