Open hackzaid opened 2 years ago
You can manually edit the OpenAPI data blob in a process_apispec
handler.
The documentation for the format is here. To add a server you will need to add your entry in the servers
key. Something like this:
@apifairy.process_apispec
def my_apispec_processor(spec):
spec['servers'][0]['description'] = 'Production server'
spec['servers'].append({'url': 'https://staging.example.com', 'description': 'Staging server'})
return spec
The first line adds a description to the main server (added by APIFairy automatically). The second line adds a second server, also with a description. The definition of what keys can be used to describe a server is here.
Thanks, this worked perfectly.
Allow me to reopen this.
So, I have set all the neccessary URL for the API.
What is required is that I want to serve the docs on a different URL and maintain the API on the set Server URLs.
According to the documentation, you can set to serve the /docs
URL with this configuration APIFAIRY_UI_PATH
?
I'm sorry, but I don't understand what is the problem that needs addressing. Have you tried changing your docs URL? Is anything not working as documented?
Exactly, I am looking for a way on how to serve the docs on a different URL, e.g: Host the API on api.somedomain.com and then access the docs on developer.somedomain.com.
Not to forget, the FileField doesn't support multiple file uploads?
You are going to have to serve your documentation yourself. Are you reading the documentation? This is all covered there: https://apifairy.readthedocs.io/en/latest/intro.html#using-a-custom-documentation-endpoint.
Not to forget, the FileField doesn't support multiple file uploads?
FileField represents one uploaded file.
Hi @miguelgrinberg I see in the core file there's support for multiple Server URLs or if I am mistaken with this line
How do I set the second URL for instance if I want to set a sandbox and live server URL.