Sphinx describe valid input values to api
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Riding Sky Waves v001
--
Chapters
00:00 Sphinx Describe Valid Input Values To Api
01:55 Accepted Answer Score 3
03:21 Thank you
--
Full question
https://stackoverflow.com/questions/2997...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #api #flask #pythonsphinx #documentationgeneration
#avk47
ACCEPTED ANSWER
Score 3
A good approach is to look at existing documentation of a popular and well-documented project such as Python itself. Python documentation uses several methods to documenting parameters that can take one of a set of values:
- Textual form as in ZipFile:
 
The mode parameter should be 'r' to read an existing file, 'w' to truncate and write a new file, or 'a' to append to an existing file.
- Bullet list of values, possibly with descriptions, as in os.chmod:
 
mode may take one of the following values (as defined in the stat module) or bitwise ORed combinations of them:
- stat.S_ISUID
 - stat.S_ISGID
 - stat.S_ENFMT
 
- Table of values and their descriptions as in format specification mini-language.
 
Edit
In the spirit of this answer, the documentation for the numpy.array order parameter starts as follows:
order : {'K', 'A', 'C', 'F'}, optional
Here we see that the allowed values are written as the type. That is, rather than specifying that order takes the type str and then explaining what specific str values are allowed, the set of values that are allowed are listed as the type and users infer the type is str.