0

In the context of a npm / nodejs web app, would there be a way to convert an OpenAPI V3 json object into Swagger HTML to dynamically update a DIV thru jQuery ?

Thanks

Fred
  • 49
  • 2
  • 8
  • What exactly are you trying to achieve? (E.g. embed Swagger UI into another web page, customize some sections of Swagger UI, etc.) – Helen Dec 15 '20 at 16:22
  • Yes, wanna display generated swagger into another web page which contains a section for it... – Fred Dec 15 '20 at 16:36
  • Does this answer your question -- [How to embed Swagger UI into a webpage?](https://stackoverflow.com/q/46237255/113116) Also check out Swagger UI's npm package: https://www.npmjs.com/package/swagger-ui – Helen Dec 15 '20 at 19:28
  • Indeed. But I'm missing how to convert an OpenAPI json into a Swagger json... – Fred Dec 15 '20 at 21:44
  • OpenAPI is the new name for the Swagger YAML/JSON file format, so there's no need to convert anything. Swagger UI can render both `openapi: 3.0.x` files and `swagger: '2.0'` files. – Helen Dec 15 '20 at 22:05
  • Got it. Point is: I receive the OpenAPI from an Ajax request, so I have the OpenAPI in a variable. How to pass this object to SwaggerUIBundle ? Is there a way to set the OpenAPI instead of specifying a URL to an OpenAPI file ? – Fred Dec 15 '20 at 22:56
  • 1
    Found how. By using the spec parameter with SwaggerUIBundle. – Fred Dec 15 '20 at 22:57

0 Answers0