swagger-api / swagger-parser

Swagger Spec to Java POJOs
http://swagger.io
Apache License 2.0
773 stars 526 forks source link

No out-of-the-box methods to serialize SwaggerParseResult back into JSON #2029

Open NadChel opened 6 months ago

NadChel commented 6 months ago

I discovered that OpenAPIV3Parser provides methods to deserialize Open API doc JSON, but doesn't allow to serialize it back. If, for example, I need to make a deep copy of SwaggerParseResult, I can't serialize it back into a JSON and then create a new SwaggerParseResult by deserializing that JSON. In fact, I'm not sure what the official guideline is for recovering the original JSON from SwaggerParseResult (suppose I don't store it in memory)

Please consider providing out-of-the-box methods to serialize SwaggerParseResult back into JSON

mfrappier1 commented 5 months ago

I found the methods to serialize back to yaml or json in the SwaggerParser class output = Yaml.pretty(result.getOpenAPI());