I need to read, modify and re-generate a JSON/YAML swagger file documentation. I have deserialized a JSON file with Swagger Parser and I have a Swagger Java Object with the original JSON data mapped correctly.
Now, I need to modify the Swagger Java object, and generate a JSON or YAML file with the done modifications.
Is there a way to do that?
Summary:
File fileJSON = FileUtils.toFile(getClass().getResource("example-api-rest.json"));
Swagger swagger = new SwaggerParser().read(fileJSON.getPath()); //Got it!
...
swagger.editWhatever
...
//Here I need to generate the JSON or YAML again
Thanks.