Request Parameters¶
Here's the reference information for the request parameters.
These are the special functions that you can put inpath operation function parameters or dependency functions withAnnotated to get data from the request.
It includes:
Query()Path()Body()Cookie()Header()Form()File()
You can import them all directly fromfastapi:
fromfastapiimportBody,Cookie,File,Form,Header,Path,Queryfastapi.Query¶
Query(default=Undefined,*,default_factory=_Unset,alias=None,alias_priority=_Unset,validation_alias=None,serialization_alias=None,title=None,description=None,gt=None,ge=None,lt=None,le=None,min_length=None,max_length=None,pattern=None,regex=None,discriminator=None,strict=_Unset,multiple_of=_Unset,allow_inf_nan=_Unset,max_digits=_Unset,decimal_places=_Unset,examples=None,example=_Unset,openapi_examples=None,deprecated=None,include_in_schema=True,json_schema_extra=None,**extra)| PARAMETER | DESCRIPTION |
|---|---|
default | Default value if the parameter field is not set. Read more about it in theFastAPI docs about Query parameters TYPE: |
default_factory | A callable to generate the default value. This doesn't affect TYPE: |
alias | An alternative name for the parameter field. This will be used to extract the data and for the generated OpenAPI.It is particularly useful when you can't use the name you want because itis a Python reserved keyword or similar. Read more about it in theFastAPI docs about Query parameters TYPE: |
alias_priority | Priority of the alias. This affects whether an alias generator is used. TYPE: |
validation_alias | 'Whitelist' validation step. The parameter field will be the single oneallowed by the alias or set of aliases defined. TYPE: |
serialization_alias | 'Blacklist' validation step. The vanilla parameter field will be thesingle one of the alias' or set of aliases' fields and all the otherfields will be ignored at serialization time. TYPE: |
title | Human-readable title. Read more about it in theFastAPI docs about Query parameters TYPE: |
description | Human-readable description. Read more about it in theFastAPI docs about Query parameters TYPE: |
gt | Greater than. If set, value must be greater than this. Only applicable tonumbers. Read more about it in theFastAPI docs about Path parameters numeric validations TYPE: |
ge | Greater than or equal. If set, value must be greater than or equal tothis. Only applicable to numbers. Read more about it in theFastAPI docs about Path parameters numeric validations TYPE: |
lt | Less than. If set, value must be less than this. Only applicable to numbers. Read more about it in theFastAPI docs about Path parameters numeric validations TYPE: |
le | Less than or equal. If set, value must be less than or equal to this.Only applicable to numbers. Read more about it in theFastAPI docs about Path parameters numeric validations TYPE: |
min_length | Minimum length for strings. Read more about it in theFastAPI docs about Query parameters TYPE: |
max_length | Maximum length for strings. Read more about it in theFastAPI docs about Query parameters TYPE: |
pattern | RegEx pattern for strings. Read more about it in the[FastAPI docs about Query parameters](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#add-regular-expressions TYPE: |
regex | Deprecated in FastAPI 0.100.0 and Pydantic v2, use TYPE: |
discriminator | Parameter field name for discriminating the type in a tagged union. TYPE: |
strict | If TYPE: |
multiple_of | Value must be a multiple of this. Only applicable to numbers. TYPE: |
allow_inf_nan | Allow TYPE: |
max_digits | Maximum number of allow digits for strings. TYPE: |
decimal_places | Maximum number of decimal places allowed for numbers. TYPE: |
examples | Example values for this field. Read more about it in theFastAPI docs for Declare Request Example Data TYPE: |
example | Deprecated in OpenAPI 3.1.0 that now uses JSON Schema 2020-12, although still supported. Use examples instead. TYPE: |
openapi_examples | OpenAPI-specific examples. It will be added to the generated OpenAPI (e.g. visible at Swagger UI (that provides the Read more about it in theFastAPI docs for Declare Request Example Data. TYPE: |
deprecated | Mark this parameter field as deprecated. It will affect the generated OpenAPI (e.g. visible at Read more about it in theFastAPI docs about Query parameters TYPE: |
include_in_schema | To include (or not) this parameter field in the generated OpenAPI.You probably don't need it, but it's available. This affects the generated OpenAPI (e.g. visible at Read more about it in the[FastAPI docs about Query parameters](https://fastapi.tiangolo.com/tutorial/query-params-str-validations/#exclude-parameters-from-openapi TYPE: |
json_schema_extra | Any additional JSON schema data. TYPE: |
**extra | The TYPE: |
Source code infastapi/param_functions.py
358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699 | |
fastapi.Path¶
Path(default=...,*,default_factory=_Unset,alias=None,alias_priority=_Unset,validation_alias=None,serialization_alias=None,title=None,description=None,gt=None,ge=None,lt=None,le=None,min_length=None,max_length=None,pattern=None,regex=None,discriminator=None,strict=_Unset,multiple_of=_Unset,allow_inf_nan=_Unset,max_digits=_Unset,decimal_places=_Unset,examples=None,example=_Unset,openapi_examples=None,deprecated=None,include_in_schema=True,json_schema_extra=None,**extra)Declare a path parameter for apath operation.
Read more about it in theFastAPI docs for Path Parameters and Numeric Validations.
fromtypingimportAnnotatedfromfastapiimportFastAPI,Pathapp=FastAPI()@app.get("/items/{item_id}")asyncdefread_items(item_id:Annotated[int,Path(title="The ID of the item to get")],):return{"item_id":item_id}| PARAMETER | DESCRIPTION |
|---|---|
default | Default value if the parameter field is not set. This doesn't affect TYPE: |
default_factory | A callable to generate the default value. This doesn't affect TYPE: |
alias | An alternative name for the parameter field. This will be used to extract the data and for the generated OpenAPI.It is particularly useful when you can't use the name you want because itis a Python reserved keyword or similar. TYPE: |
alias_priority | Priority of the alias. This affects whether an alias generator is used. TYPE: |
validation_alias | 'Whitelist' validation step. The parameter field will be the single oneallowed by the alias or set of aliases defined. TYPE: |
serialization_alias | 'Blacklist' validation step. The vanilla parameter field will be thesingle one of the alias' or set of aliases' fields and all the otherfields will be ignored at serialization time. TYPE: |
title | Human-readable title. Read more about it in theFastAPI docs for Path Parameters and Numeric Validations TYPE: |
description | Human-readable description. TYPE: |
gt | Greater than. If set, value must be greater than this. Only applicable tonumbers. Read more about it in theFastAPI docs about Path parameters numeric validations TYPE: |
ge | Greater than or equal. If set, value must be greater than or equal tothis. Only applicable to numbers. Read more about it in theFastAPI docs about Path parameters numeric validations TYPE: |
lt | Less than. If set, value must be less than this. Only applicable to numbers. Read more about it in theFastAPI docs about Path parameters numeric validations TYPE: |
le | Less than or equal. If set, value must be less than or equal to this.Only applicable to numbers. Read more about it in theFastAPI docs about Path parameters numeric validations TYPE: |
min_length | Minimum length for strings. TYPE: |
max_length | Maximum length for strings. TYPE: |
pattern | RegEx pattern for strings. TYPE: |
regex | Deprecated in FastAPI 0.100.0 and Pydantic v2, use TYPE: |
discriminator | Parameter field name for discriminating the type in a tagged union. TYPE: |
strict | If TYPE: |
multiple_of | Value must be a multiple of this. Only applicable to numbers. TYPE: |
allow_inf_nan | Allow TYPE: |
max_digits | Maximum number of allow digits for strings. TYPE: |
decimal_places | Maximum number of decimal places allowed for numbers. TYPE: |
examples | Example values for this field. Read more about it in theFastAPI docs for Declare Request Example Data TYPE: |
example | Deprecated in OpenAPI 3.1.0 that now uses JSON Schema 2020-12, although still supported. Use examples instead. TYPE: |
openapi_examples | OpenAPI-specific examples. It will be added to the generated OpenAPI (e.g. visible at Swagger UI (that provides the Read more about it in theFastAPI docs for Declare Request Example Data. TYPE: |
deprecated | Mark this parameter field as deprecated. It will affect the generated OpenAPI (e.g. visible at TYPE: |
include_in_schema | To include (or not) this parameter field in the generated OpenAPI.You probably don't need it, but it's available. This affects the generated OpenAPI (e.g. visible at TYPE: |
json_schema_extra | Any additional JSON schema data. TYPE: |
**extra | The TYPE: |
Source code infastapi/param_functions.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355 | |
fastapi.Body¶
Body(default=Undefined,*,default_factory=_Unset,embed=None,media_type="application/json",alias=None,alias_priority=_Unset,validation_alias=None,serialization_alias=None,title=None,description=None,gt=None,ge=None,lt=None,le=None,min_length=None,max_length=None,pattern=None,regex=None,discriminator=None,strict=_Unset,multiple_of=_Unset,allow_inf_nan=_Unset,max_digits=_Unset,decimal_places=_Unset,examples=None,example=_Unset,openapi_examples=None,deprecated=None,include_in_schema=True,json_schema_extra=None,**extra)| PARAMETER | DESCRIPTION |
|---|---|
default | Default value if the parameter field is not set. TYPE: |
default_factory | A callable to generate the default value. This doesn't affect TYPE: |
embed | When This happens automatically when more than one Read more about it in theFastAPI docs for Body - Multiple Parameters. TYPE: |
media_type | The media type of this parameter field. Changing it would affect thegenerated OpenAPI, but currently it doesn't affect the parsing of the data. TYPE: |
alias | An alternative name for the parameter field. This will be used to extract the data and for the generated OpenAPI.It is particularly useful when you can't use the name you want because itis a Python reserved keyword or similar. TYPE: |
alias_priority | Priority of the alias. This affects whether an alias generator is used. TYPE: |
validation_alias | 'Whitelist' validation step. The parameter field will be the single oneallowed by the alias or set of aliases defined. TYPE: |
serialization_alias | 'Blacklist' validation step. The vanilla parameter field will be thesingle one of the alias' or set of aliases' fields and all the otherfields will be ignored at serialization time. TYPE: |
title | Human-readable title. TYPE: |
description | Human-readable description. TYPE: |
gt | Greater than. If set, value must be greater than this. Only applicable tonumbers. TYPE: |
ge | Greater than or equal. If set, value must be greater than or equal tothis. Only applicable to numbers. TYPE: |
lt | Less than. If set, value must be less than this. Only applicable to numbers. TYPE: |
le | Less than or equal. If set, value must be less than or equal to this.Only applicable to numbers. TYPE: |
min_length | Minimum length for strings. TYPE: |
max_length | Maximum length for strings. TYPE: |
pattern | RegEx pattern for strings. TYPE: |
regex | Deprecated in FastAPI 0.100.0 and Pydantic v2, use TYPE: |
discriminator | Parameter field name for discriminating the type in a tagged union. TYPE: |
strict | If TYPE: |
multiple_of | Value must be a multiple of this. Only applicable to numbers. TYPE: |
allow_inf_nan | Allow TYPE: |
max_digits | Maximum number of allow digits for strings. TYPE: |
decimal_places | Maximum number of decimal places allowed for numbers. TYPE: |
examples | Example values for this field. Read more about it in theFastAPI docs for Declare Request Example Data TYPE: |
example | Deprecated in OpenAPI 3.1.0 that now uses JSON Schema 2020-12, although still supported. Use examples instead. TYPE: |
openapi_examples | OpenAPI-specific examples. It will be added to the generated OpenAPI (e.g. visible at Swagger UI (that provides the Read more about it in theFastAPI docs for Declare Request Example Data. TYPE: |
deprecated | Mark this parameter field as deprecated. It will affect the generated OpenAPI (e.g. visible at TYPE: |
include_in_schema | To include (or not) this parameter field in the generated OpenAPI.You probably don't need it, but it's available. This affects the generated OpenAPI (e.g. visible at TYPE: |
json_schema_extra | Any additional JSON schema data. TYPE: |
**extra | The TYPE: |
Source code infastapi/param_functions.py
1324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651 | |
fastapi.Cookie¶
Cookie(default=Undefined,*,default_factory=_Unset,alias=None,alias_priority=_Unset,validation_alias=None,serialization_alias=None,title=None,description=None,gt=None,ge=None,lt=None,le=None,min_length=None,max_length=None,pattern=None,regex=None,discriminator=None,strict=_Unset,multiple_of=_Unset,allow_inf_nan=_Unset,max_digits=_Unset,decimal_places=_Unset,examples=None,example=_Unset,openapi_examples=None,deprecated=None,include_in_schema=True,json_schema_extra=None,**extra)| PARAMETER | DESCRIPTION |
|---|---|
default | Default value if the parameter field is not set. TYPE: |
default_factory | A callable to generate the default value. This doesn't affect TYPE: |
alias | An alternative name for the parameter field. This will be used to extract the data and for the generated OpenAPI.It is particularly useful when you can't use the name you want because itis a Python reserved keyword or similar. TYPE: |
alias_priority | Priority of the alias. This affects whether an alias generator is used. TYPE: |
validation_alias | 'Whitelist' validation step. The parameter field will be the single oneallowed by the alias or set of aliases defined. TYPE: |
serialization_alias | 'Blacklist' validation step. The vanilla parameter field will be thesingle one of the alias' or set of aliases' fields and all the otherfields will be ignored at serialization time. TYPE: |
title | Human-readable title. TYPE: |
description | Human-readable description. TYPE: |
gt | Greater than. If set, value must be greater than this. Only applicable tonumbers. TYPE: |
ge | Greater than or equal. If set, value must be greater than or equal tothis. Only applicable to numbers. TYPE: |
lt | Less than. If set, value must be less than this. Only applicable to numbers. TYPE: |
le | Less than or equal. If set, value must be less than or equal to this.Only applicable to numbers. TYPE: |
min_length | Minimum length for strings. TYPE: |
max_length | Maximum length for strings. TYPE: |
pattern | RegEx pattern for strings. TYPE: |
regex | Deprecated in FastAPI 0.100.0 and Pydantic v2, use TYPE: |
discriminator | Parameter field name for discriminating the type in a tagged union. TYPE: |
strict | If TYPE: |
multiple_of | Value must be a multiple of this. Only applicable to numbers. TYPE: |
allow_inf_nan | Allow TYPE: |
max_digits | Maximum number of allow digits for strings. TYPE: |
decimal_places | Maximum number of decimal places allowed for numbers. TYPE: |
examples | Example values for this field. Read more about it in theFastAPI docs for Declare Request Example Data TYPE: |
example | Deprecated in OpenAPI 3.1.0 that now uses JSON Schema 2020-12, although still supported. Use examples instead. TYPE: |
openapi_examples | OpenAPI-specific examples. It will be added to the generated OpenAPI (e.g. visible at Swagger UI (that provides the Read more about it in theFastAPI docs for Declare Request Example Data. TYPE: |
deprecated | Mark this parameter field as deprecated. It will affect the generated OpenAPI (e.g. visible at TYPE: |
include_in_schema | To include (or not) this parameter field in the generated OpenAPI.You probably don't need it, but it's available. This affects the generated OpenAPI (e.g. visible at TYPE: |
json_schema_extra | Any additional JSON schema data. TYPE: |
**extra | The TYPE: |
Source code infastapi/param_functions.py
101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321 | |
fastapi.Header¶
Header(default=Undefined,*,default_factory=_Unset,alias=None,alias_priority=_Unset,validation_alias=None,serialization_alias=None,convert_underscores=True,title=None,description=None,gt=None,ge=None,lt=None,le=None,min_length=None,max_length=None,pattern=None,regex=None,discriminator=None,strict=_Unset,multiple_of=_Unset,allow_inf_nan=_Unset,max_digits=_Unset,decimal_places=_Unset,examples=None,example=_Unset,openapi_examples=None,deprecated=None,include_in_schema=True,json_schema_extra=None,**extra)| PARAMETER | DESCRIPTION |
|---|---|
default | Default value if the parameter field is not set. TYPE: |
default_factory | A callable to generate the default value. This doesn't affect TYPE: |
alias | An alternative name for the parameter field. This will be used to extract the data and for the generated OpenAPI.It is particularly useful when you can't use the name you want because itis a Python reserved keyword or similar. TYPE: |
alias_priority | Priority of the alias. This affects whether an alias generator is used. TYPE: |
validation_alias | 'Whitelist' validation step. The parameter field will be the single oneallowed by the alias or set of aliases defined. TYPE: |
serialization_alias | 'Blacklist' validation step. The vanilla parameter field will be thesingle one of the alias' or set of aliases' fields and all the otherfields will be ignored at serialization time. TYPE: |
convert_underscores | Automatically convert underscores to hyphens in the parameter field name. Read more about it in theFastAPI docs for Header Parameters TYPE: |
title | Human-readable title. TYPE: |
description | Human-readable description. TYPE: |
gt | Greater than. If set, value must be greater than this. Only applicable tonumbers. TYPE: |
ge | Greater than or equal. If set, value must be greater than or equal tothis. Only applicable to numbers. TYPE: |
lt | Less than. If set, value must be less than this. Only applicable to numbers. TYPE: |
le | Less than or equal. If set, value must be less than or equal to this.Only applicable to numbers. TYPE: |
min_length | Minimum length for strings. TYPE: |
max_length | Maximum length for strings. TYPE: |
pattern | RegEx pattern for strings. TYPE: |
regex | Deprecated in FastAPI 0.100.0 and Pydantic v2, use TYPE: |
discriminator | Parameter field name for discriminating the type in a tagged union. TYPE: |
strict | If TYPE: |
multiple_of | Value must be a multiple of this. Only applicable to numbers. TYPE: |
allow_inf_nan | Allow TYPE: |
max_digits | Maximum number of allow digits for strings. TYPE: |
decimal_places | Maximum number of decimal places allowed for numbers. TYPE: |
examples | Example values for this field. Read more about it in theFastAPI docs for Declare Request Example Data TYPE: |
example | Deprecated in OpenAPI 3.1.0 that now uses JSON Schema 2020-12, although still supported. Use examples instead. TYPE: |
openapi_examples | OpenAPI-specific examples. It will be added to the generated OpenAPI (e.g. visible at Swagger UI (that provides the Read more about it in theFastAPI docs for Declare Request Example Data. TYPE: |
deprecated | Mark this parameter field as deprecated. It will affect the generated OpenAPI (e.g. visible at TYPE: |
include_in_schema | To include (or not) this parameter field in the generated OpenAPI.You probably don't need it, but it's available. This affects the generated OpenAPI (e.g. visible at TYPE: |
json_schema_extra | Any additional JSON schema data. TYPE: |
**extra | The TYPE: |
Source code infastapi/param_functions.py
702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 99910001001100210031004100510061007100810091010101110121013101410151016 | |
fastapi.Form¶
Form(default=Undefined,*,default_factory=_Unset,media_type="application/x-www-form-urlencoded",alias=None,alias_priority=_Unset,validation_alias=None,serialization_alias=None,title=None,description=None,gt=None,ge=None,lt=None,le=None,min_length=None,max_length=None,pattern=None,regex=None,discriminator=None,strict=_Unset,multiple_of=_Unset,allow_inf_nan=_Unset,max_digits=_Unset,decimal_places=_Unset,examples=None,example=_Unset,openapi_examples=None,deprecated=None,include_in_schema=True,json_schema_extra=None,**extra)| PARAMETER | DESCRIPTION |
|---|---|
default | Default value if the parameter field is not set. TYPE: |
default_factory | A callable to generate the default value. This doesn't affect TYPE: |
media_type | The media type of this parameter field. Changing it would affect thegenerated OpenAPI, but currently it doesn't affect the parsing of the data. TYPE: |
alias | An alternative name for the parameter field. This will be used to extract the data and for the generated OpenAPI.It is particularly useful when you can't use the name you want because itis a Python reserved keyword or similar. TYPE: |
alias_priority | Priority of the alias. This affects whether an alias generator is used. TYPE: |
validation_alias | 'Whitelist' validation step. The parameter field will be the single oneallowed by the alias or set of aliases defined. TYPE: |
serialization_alias | 'Blacklist' validation step. The vanilla parameter field will be thesingle one of the alias' or set of aliases' fields and all the otherfields will be ignored at serialization time. TYPE: |
title | Human-readable title. TYPE: |
description | Human-readable description. TYPE: |
gt | Greater than. If set, value must be greater than this. Only applicable tonumbers. TYPE: |
ge | Greater than or equal. If set, value must be greater than or equal tothis. Only applicable to numbers. TYPE: |
lt | Less than. If set, value must be less than this. Only applicable to numbers. TYPE: |
le | Less than or equal. If set, value must be less than or equal to this.Only applicable to numbers. TYPE: |
min_length | Minimum length for strings. TYPE: |
max_length | Maximum length for strings. TYPE: |
pattern | RegEx pattern for strings. TYPE: |
regex | Deprecated in FastAPI 0.100.0 and Pydantic v2, use TYPE: |
discriminator | Parameter field name for discriminating the type in a tagged union. TYPE: |
strict | If TYPE: |
multiple_of | Value must be a multiple of this. Only applicable to numbers. TYPE: |
allow_inf_nan | Allow TYPE: |
max_digits | Maximum number of allow digits for strings. TYPE: |
decimal_places | Maximum number of decimal places allowed for numbers. TYPE: |
examples | Example values for this field. Read more about it in theFastAPI docs for Declare Request Example Data TYPE: |
example | Deprecated in OpenAPI 3.1.0 that now uses JSON Schema 2020-12, although still supported. Use examples instead. TYPE: |
openapi_examples | OpenAPI-specific examples. It will be added to the generated OpenAPI (e.g. visible at Swagger UI (that provides the Read more about it in theFastAPI docs for Declare Request Example Data. TYPE: |
deprecated | Mark this parameter field as deprecated. It will affect the generated OpenAPI (e.g. visible at TYPE: |
include_in_schema | To include (or not) this parameter field in the generated OpenAPI.You probably don't need it, but it's available. This affects the generated OpenAPI (e.g. visible at TYPE: |
json_schema_extra | Any additional JSON schema data. TYPE: |
**extra | The TYPE: |
Source code infastapi/param_functions.py
1654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966 | |
fastapi.File¶
File(default=Undefined,*,default_factory=_Unset,media_type="multipart/form-data",alias=None,alias_priority=_Unset,validation_alias=None,serialization_alias=None,title=None,description=None,gt=None,ge=None,lt=None,le=None,min_length=None,max_length=None,pattern=None,regex=None,discriminator=None,strict=_Unset,multiple_of=_Unset,allow_inf_nan=_Unset,max_digits=_Unset,decimal_places=_Unset,examples=None,example=_Unset,openapi_examples=None,deprecated=None,include_in_schema=True,json_schema_extra=None,**extra)| PARAMETER | DESCRIPTION |
|---|---|
default | Default value if the parameter field is not set. TYPE: |
default_factory | A callable to generate the default value. This doesn't affect TYPE: |
media_type | The media type of this parameter field. Changing it would affect thegenerated OpenAPI, but currently it doesn't affect the parsing of the data. TYPE: |
alias | An alternative name for the parameter field. This will be used to extract the data and for the generated OpenAPI.It is particularly useful when you can't use the name you want because itis a Python reserved keyword or similar. TYPE: |
alias_priority | Priority of the alias. This affects whether an alias generator is used. TYPE: |
validation_alias | 'Whitelist' validation step. The parameter field will be the single oneallowed by the alias or set of aliases defined. TYPE: |
serialization_alias | 'Blacklist' validation step. The vanilla parameter field will be thesingle one of the alias' or set of aliases' fields and all the otherfields will be ignored at serialization time. TYPE: |
title | Human-readable title. TYPE: |
description | Human-readable description. TYPE: |
gt | Greater than. If set, value must be greater than this. Only applicable tonumbers. TYPE: |
ge | Greater than or equal. If set, value must be greater than or equal tothis. Only applicable to numbers. TYPE: |
lt | Less than. If set, value must be less than this. Only applicable to numbers. TYPE: |
le | Less than or equal. If set, value must be less than or equal to this.Only applicable to numbers. TYPE: |
min_length | Minimum length for strings. TYPE: |
max_length | Maximum length for strings. TYPE: |
pattern | RegEx pattern for strings. TYPE: |
regex | Deprecated in FastAPI 0.100.0 and Pydantic v2, use TYPE: |
discriminator | Parameter field name for discriminating the type in a tagged union. TYPE: |
strict | If TYPE: |
multiple_of | Value must be a multiple of this. Only applicable to numbers. TYPE: |
allow_inf_nan | Allow TYPE: |
max_digits | Maximum number of allow digits for strings. TYPE: |
decimal_places | Maximum number of decimal places allowed for numbers. TYPE: |
examples | Example values for this field. Read more about it in theFastAPI docs for Declare Request Example Data TYPE: |
example | Deprecated in OpenAPI 3.1.0 that now uses JSON Schema 2020-12, although still supported. Use examples instead. TYPE: |
openapi_examples | OpenAPI-specific examples. It will be added to the generated OpenAPI (e.g. visible at Swagger UI (that provides the Read more about it in theFastAPI docs for Declare Request Example Data. TYPE: |
deprecated | Mark this parameter field as deprecated. It will affect the generated OpenAPI (e.g. visible at TYPE: |
include_in_schema | To include (or not) this parameter field in the generated OpenAPI.You probably don't need it, but it's available. This affects the generated OpenAPI (e.g. visible at TYPE: |
json_schema_extra | Any additional JSON schema data. TYPE: |
**extra | The TYPE: |
Source code infastapi/param_functions.py
1969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281 | |







