Does pactflow support uploading multiple JSON fil...
# pactflow
b
Does pactflow support uploading multiple JSON files in cases where the provider contract's base openapi.json file contains relative $ref references of the form `"$ref": "./shared-parameters.json#/components/parameters/myparameter"`"? If I attempt to use pactflow to upload multiple files to pactbroker, I get the following error on the second file:
Copy code
A provider contract for <my-service> version <my-service=-version> already exists with different content and may not be modified.
I guess the next obvious question is whether pact-broker even supports relative $ref references in the base openapi spec JSON file.
y
https://docs.pactflow.io/docs/bi-directional-contract-testing/contracts/oas#document-limitations
• OAS documents must not be split across multiple files. You should combine any documents together, using tools like OpenAPI Merge or speccy. That is, PactFlow can not resolve remote references to files, and will not resolve URL references
to the 2nd point
• It is recommended to programmatically dereference and inline
$refs
in the OAS document uploaded to PactFlow, as they can cause issues when validating
nullable
fields and nested
$refs
can not be accurately compared with a pact file. This can be accomplished using packages such as json-schema-merge-allof and json-schema-resolve-allof
so merge -> deref -> upload 🙂
b
The toolchain grows again...
Thank you.
m
We are considering/investigating doing the deref for you. I suppose we could merge, but there are many hazards there (e.g. if there are references to other non-local/relative components).