Hi there!
I want to post a problem I've met when I use Portman to generate the multi-file OAS.
They are all defined under the same path, i.e.
├── A.yaml
├── B.yaml
├── C.yaml
Firstly, I have rootOAS A.yaml:
openapi: 3.1.0
...
paths:
/a/b/{id}:
summary: An Endpoint
post:
parameters:
- in: path
name: id
schema:
type: string
required: true
requestBody:
required: true
content:
application/json:
schema:
$ref: "./B.yaml#/components/schemas/action"
As you can see, the rootOAS refers to B schema
B.yaml
components:
schemas:
action:
anyOf:
- $ref: "C.yaml#/components/schemas/Cart"
Which internally refers to C Schmea
C.yaml
components:
schemas:
Cart:
type: object
allOf:
- properties:
id:
type: string
Then when I tried to generate collection with portman command feeding the rootOAS
portman -l ./A.yaml --cliOptionsFile ./portman/configs/portman-cli.json -o ./definitions/postman.json
I got error:
Portman config file not provided.
ResolverError: Error opening file "/Users/my.name/documents/tmp/converted/schemas/B.yaml"
ENOENT: no such file or directory, open '/Users/my.name/documents/tmp/converted/schemas/B.yaml'
I saw someone posted a similar question, and the answer said Portman will de-reference before doing the converting, but here the problem is obvisouly the rootOAS A.yaml got convert Before dereferencing other OAS.
One workaround I've made it work is change the reference path from A to B:
$ref: "../../B.yaml#/components/schemas/action"
It works but not really seems to be correct to me.
Any help will be appreciated, thanks!
Hi there!
I want to post a problem I've met when I use Portman to generate the multi-file OAS.
They are all defined under the same path, i.e.
├── A.yaml
├── B.yaml
├── C.yaml
Firstly, I have rootOAS A.yaml:
As you can see, the rootOAS refers to B schema
B.yaml
Which internally refers to C Schmea
C.yaml
Then when I tried to generate collection with portman command feeding the rootOAS
portman -l ./A.yaml --cliOptionsFile ./portman/configs/portman-cli.json -o ./definitions/postman.jsonI got error:
I saw someone posted a similar question, and the answer said Portman will de-reference before doing the converting, but here the problem is obvisouly the rootOAS A.yaml got convert Before dereferencing other OAS.
One workaround I've made it work is change the reference path from A to B:
$ref: "../../B.yaml#/components/schemas/action"It works but not really seems to be correct to me.
Any help will be appreciated, thanks!