-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to retain the info
field from each API?
#58
Comments
Unfortunately this is not possible in the current version. Maybe we'll implement this feature in the future. Could you please describe your use case or why you need the data from the info object? |
Hey there, I also need this! We have multiple swagger specs that are considered separate APIs by the company, but require a combined set of documentation so we can plug it into Redoc. I'm using swagger-combine to solve this, just needing the info section retained and it'll be perfect! |
Maybe it could be possible if we could access the raw objects from swagger-combine after it's done? const swaggerCombine = require('swagger-combine');
swaggerCombine('config.json')
.then(res => {
// make special combines before exporting file, securitySchemas, info e.g.
// get all loaded documentations and loop
console.log(JSON.stringify(res));
})
.catch(err => console.error(err)); |
My solution became this const fs = require('fs');
const SwaggerCombine = require('swagger-combine');
const output = 'parsed.json';
const config = 'config.json';
const opts = {};
const combinedSchemaData = new SwaggerCombine.SwaggerCombine(config, opts);
const postOutput = (schema)=>{
fs.writeFileSync(output, JSON.stringify(schema, null, 2));
console.log("done and happy");
}
const postProcess = (parsedObject)=>{
let obj = {...parsedObject.combinedSchema};
parsedObject.schemas.forEach((item)=>{
console.log("Add things to obj");
})
postOutput(obj);
}
combinedSchemaData.combine()
.then(result => {
postProcess(result);
})
.catch(error => {
console.error(error.message);
process.exit(1);
}); |
Hi! How can I retain the information about each API (the Info Object) in the produced output?
The text was updated successfully, but these errors were encountered: