I have multi-file open api 2.0 definition, main file is called main_openapi.yaml
that contains the top level fields and further details are in separate files. I want to convert this definition to 3.0 spec definition without changing the folder structure or combining them in to one yaml file.
Below are the details of my spec:
swagger: "2.0"
info:
title: Sample API
description: API description in Markdown.
version: 1.0.0
host: api.example.com
basePath: /v1
schemes:
- https
tags:
- name: user
description: Operations about user
- name: health
description: Operations about health
paths:
/users:
$ref: './user/userCreate.yaml'
/users/{userId}:
$ref: './user/userUpdate.yaml'
/users/list:
$ref: './user/userList.yaml'
/groups:
$ref: './group/groupCreate.yaml'
/groups/{groupId}:
$ref: './group/groupUpdate.yaml'
/groups/list:
$ref: './group/groupList.yaml'
/locations:
$ref: './location/locationCreate.yaml'
/locations/{locationId}:
$ref: './location/locationUpdate.yaml'
/locations/list:
$ref: './location/locationList.yaml'
Tried
openapi-generator-cli generate -c config.json
tried with a conf file as shown below:
{
"openapi-version": "3.0.0",
"info": {
"title": "OpenAPI Specification 2.0 YAML File Conversion",
"version": "1.0.0"
},
"generator": "openapi-generator-cli",
"config": {
"input-files": [
"specs/main_openapi.yaml"
],
"output-format": "yaml",
"output-file": "openapi_gen.yaml",
"preserve-file-structure": true,
"preserve-refs": true
}
}
getting this error :
Unable to query repository, because of: "Request failed with status code 504"
Response:
date Tue, 13 Jun 2023 15:59:58 GMT
content-type text/html
content-length 160
connection close
server nginx
redoc-cli bundle -o output.yaml input.yaml
-> convert using swagger editor online ->redoc-cli split -o output-folder input.yaml
The file structure is not preserved