Open Rcuz8 opened 6 months ago
Hi @Rcuz8 ,
I suppose it may be related to the usage of $ref
in yaml files. Just to confirm, does it work if you replace the ref directly by the yaml content of the other file?
@javierbrea Yes, it does! When the yaml content is injected directly, it works.
Is there any more info you would need? @javierbrea
No, thank you @Rcuz8 , I think that it is enough to confirm where is the problem.
Describe the bug I'm just trying to run a mock server that builds from a YAML OpenAPI spec. The setup steps in the OpenAPI guide seem to work perfectly for JSON.. but not for YAML.
Here's my config: (Bear mind, my usage of these entities may not be correct)
mocks/documents/api.yaml
: (Basic api spec, validated on http://www.yamllint.com/)mocks/openapi/definitions.yaml
: (Basic definitions file)mocks/collections.json
: (Basic collections file)mocks.config.js
: (Default mocks-server config file)When I run
npx mocks-server
, I see this error:Now, I have one other OpenAPI spec file,
mocks/documents/alt.json
. When I switch to using that one instead ofmocks/documents/api.yaml
, it works without issue.My guess is it's an issue with the YAML support in the
mocks-server
library (Which is why I'm bringing it here).To Reproduce Follow the steps in the Installation and OpenAPI integration guides
Expected behavior I expect the server to start without error and serve the endpoints defined in
api.yaml
.Logs If applicable, add logs to help explain your problem.
Operating system, Node.js an npm versions, or browser version (please complete the following information):
v20.11.0
10.2.4
Additional context Add any other context about the problem here.