Closed Traderjoe95 closed 1 month ago
Thanks @Traderjoe95 for this issue. I think it is related to https://github.com/eclipse-vertx/vertx-openapi/issues/16 which @pk-work did some work on. His branch 4_x_issue_16 had the changes. I'll check later today/this week if this solves your issue too (or feel free to checkout the branch yourself and test locally, it may just be out of date with the latest).
@Traderjoe95 I've rebased and made a few additional changes. I've created a unit test using your reproducer (1). It is passing now, but there is 1 thing with your spec that you may have to change:
From:
$ref: 'schemas/Name.yaml'
To:
$ref: 'https://schemas/Name.yaml'
and when creating the contract:
From:
Map<String, String> additional = new HashMap<>();
additional.put("schemas/Name.yaml", "name.yaml");
To:
Map<String, String> additional = new HashMap<>();
additional.put("https://schemas/Name.yaml", "name.yaml");
This is just a small quark in the underlying json schema. If no URL schema (https://) is provided a basic one (app:///) is prepended.
Version
4.5.9
Context
I tried to split my OpenAPI document across multiple files by extracting some larger schema definitions to their separate files. To allow loading these files, I added them as
additionalContractFiles
in the call toOpenAPIContract.from
. This fails because the additional files are validated against the full OpenAPI 3.1.0 specification, while they contain a simple JSON Schema.In my opinion, the parser should offer the opportunity to reference arbitrary files, as long as the resulting schema is aligned with the OpenAPI specification.
Steps to reproduce
Here's a minimal schema to reproduce this:
openapi/openapi.yaml
openapi/schemas/Name.yaml
Parsing the Contract
results in