Replies: 3 comments 3 replies
-
How about making it easier to load an api spec from file? eg: plug PutApiSpec, file: "priv/static/openapi.json" Then you can build the API spec ahead of time using the existing |
Beta Was this translation helpful? Give feedback.
-
In general I'd avoid this style of configuration:
It assumes there is a single API, which is often not the case. Eg see the example from the phoenix_swagger docs:
But even that isn't ideal as it assumes that each API is driven by a single router. |
Beta Was this translation helpful? Give feedback.
-
The issues with
|
Beta Was this translation helpful? Give feedback.
-
Since my last contribution, I have been experimenting on how to shift the specification build from the runtime to the compile time, keeping only utilities such as Swagger UI. The caching mechanism via the PutSpec is kind of unnatural in user space since an OpenAPI (should?) be static at compile time but have some kind of caching mechanism.
I know that the library used
@doc
annotations in the past, but I'm still wondering if the idea of using them alongside a Mix Compile Task to fetch every documentation usingConfig
as configuration entrypoint such as:And this compile command will output the static OpenAPI spec in the assets directory that will be use by the Swagger UI.
I was inspired by the recent esbuild library and hexdocs itself, do you think it is a good idea?
Beta Was this translation helpful? Give feedback.
All reactions