I have two controllers below.
import {get, getControllerSpec} from '@loopback/openapi-v3';
class MyController {
@get('/greet')
greet() {
return 'Hello world!';
}
}
const myControllerSpec = getControllerSpec(MyController);
then the myControllerSpec will be:
{
paths: {
'/greet': {
get: {
'x-operation-name': 'greet'
}
}
},
}
and
import {get, getControllerSpec} from '@loopback/openapi-v3';
class SecondController {
@get('/second')
second() {
return 'Hello world!';
}
}
const secondControllerSpec = getControllerSpec(SecondController);
then the secondControllerSpec will be:
{
paths: {
'/second': {
get: {
'x-operation-name': 'second'
}
}
},
}
I want to merge 2 openapi into 1 file.
_Example:_
{
.
.
.
paths: {
'/greet': {
get: {
'x-operation-name': 'greet'
}
},
'/second': {
get: {
'x-operation-name': 'cond'
}
}
},
.
.
.
}
What is your suggestion?
Note: Sorry, I am not good at English.
The following seems to fit if you're looking for a library to do it for you: https://github.com/maxdome/swagger-combine
@atillart1003 What is your usecase for merging the spec manually? Why is there a need to do that?
@derdeka I want to share swaggerUi with my friend for testing api, I deploy loopback 4 project on aws lambda by claudia-api-builder but don't show swaggerUi
@atillart1003 Are you aware that you can retrieve the openapi spec at http://localhost:3000/openapi.json locally by default?
Closing due to inactivity. If you are still running into problems, feel free to leave a comment and I will reopen the issue.
Most helpful comment
@atillart1003 Are you aware that you can retrieve the openapi spec at
http://localhost:3000/openapi.jsonlocally by default?