Recommended way to serve .yaml/.json
See original GitHub issueI’m trying to find the best way to serve locally my swagger.json and set it up to get_swaggerui_blueprint
. I’m not Flask fluent and the project I’m working on configured a resource that read the json file, load it into a dict and then returns it. Surely there is a better way.
I believe would be better to have an example serving the swagger.json locally on the README.md, since it’s probably the most common use.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
YAML and JSON - Nubenetes
How to create Kubernetes YAML files; Kubernetes examples; Helm and Kustomize. JSON. ... We recommend using an API from a programming language instead...
Read more >10 YAML tips for people who hate YAML | Enable Sysadmin
In this method, you write in JSON and then run a Python conversion script to produce YAML. This scales better than self-conversion, because...
Read more >What is the difference between YAML and JSON?
Technically YAML is a superset of JSON. This means that, in theory at least, a YAML parser can understand JSON, but not necessarily...
Read more >YAML Tutorial: Everything You Need to Get Started in Minutes
Before we take a deeper dive, let's look at how this document looks in JSON. I'll throw it in this handy JSON to...
Read more >Working in YAML (OpenAPI tutorial) - Idratherbewriting.com
Many computers ingest data in a YAML or JSON format. It's a syntax commonly used in configuration files and an increasing number of...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
For a static yaml file you can do
Sorry, yeah, I meant API documentation.
In principle they are decoupled. For instance, in the application where I use this package myself, the swagger json is dynamically created from the REST API endpoints’ documentation. I don’t have an actual file on my system. I would imagine this being common for many (most?) people wanting to use this package.
Also, there can other tools using the swagger.json, which are not related to this package at all.
Creating a resource to serve the file can be as simple as creating a dumb flask resource:
Have you tried this? Is there anything preventing this from working?