Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 12 for Annotations (0.16 sec)

  1. tests/test_compat.py

    from typing import List, Union
    
    from fastapi import FastAPI, UploadFile
    from fastapi._compat import (
        ModelField,
        Undefined,
        _get_model_config,
        is_bytes_sequence_annotation,
        is_uploadfile_sequence_annotation,
    )
    from fastapi.testclient import TestClient
    from pydantic import BaseConfig, BaseModel, ConfigDict
    from pydantic.fields import FieldInfo
    
    from .utils import needs_pydanticv1, needs_pydanticv2
    
    
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Sep 28 04:14:40 GMT 2023
    - 2.8K bytes
    - Viewed (0)
  2. fastapi/params.py

                self.deprecated = deprecated
            else:
                kwargs["deprecated"] = deprecated
            if PYDANTIC_V2:
                kwargs.update(
                    {
                        "annotation": annotation,
                        "alias_priority": alias_priority,
                        "validation_alias": validation_alias,
                        "serialization_alias": serialization_alias,
                        "strict": strict,
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 27.5K bytes
    - Viewed (1)
  3. fastapi/utils.py

                f"check that {type_} is a valid Pydantic field type. "
                "If you are using a return type annotation that is not a valid Pydantic "
                "field (e.g. Union[Response, dict, None]) you can disable generating the "
                "response model from the type annotation with the path operation decorator "
                "parameter response_model=None. Read more: "
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 7.8K bytes
    - Viewed (0)
  4. tests/test_operations_signatures.py

                router_param: inspect.Parameter = router_sig.parameters[key]
                app_param: inspect.Parameter = app_sig.parameters[key]
                assert param.annotation == router_param.annotation
                assert param.annotation == app_param.annotation
                assert param.default == router_param.default
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Mon May 27 12:08:13 GMT 2019
    - 934 bytes
    - Viewed (0)
  5. fastapi/dependencies/utils.py

                field_info = params.Path(annotation=use_annotation)
            elif is_uploadfile_or_nonable_uploadfile_annotation(
                type_annotation
            ) or is_uploadfile_sequence_annotation(type_annotation):
                field_info = params.File(annotation=use_annotation, default=default_value)
            elif not field_annotation_is_scalar(annotation=type_annotation):
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Apr 02 02:52:56 GMT 2024
    - 29.5K bytes
    - Viewed (0)
  6. tests/test_ambiguous_params.py

            ),
        ):
    
            @app.get("/")
            async def get(item_id: Annotated[int, Query(default=1)]):
                pass  # pragma: nocover
    
    
    def test_multiple_annotations():
        async def dep():
            pass  # pragma: nocover
    
        @app.get("/multi-query")
        async def get(foo: Annotated[int, Query(gt=2), Query(lt=10)]):
            return foo
    
        with pytest.raises(
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Tue Dec 12 00:22:47 GMT 2023
    - 2.1K bytes
    - Viewed (0)
  7. tests/test_security_oauth2.py

            }
        }
    )
    
    
    class User(BaseModel):
        username: str
    
    
    # Here we use string annotations to test them
    def get_current_user(oauth_header: "str" = Security(reusable_oauth2)):
        user = User(username=oauth_header)
        return user
    
    
    @app.post("/login")
    # Here we use string annotations to test them
    def login(form_data: "OAuth2PasswordRequestFormStrict" = Depends()):
        return form_data
    
    
    Python
    - Registered: Sun Apr 28 07:19:10 GMT 2024
    - Last Modified: Thu Apr 18 19:40:57 GMT 2024
    - 10.7K bytes
    - Viewed (0)
  8. bin/diff_yaml.py

        parser.add_argument("--ignore-labels", action="store_true", default=False,
                            help="Ignore resource labels during comparison")
        parser.add_argument("--ignore-annotations", action="store_true", default=False,
                            help="Ignore annotations during comparison")
    
        return parser
    
    
    if __name__ == "__main__":
        parser = get_parser()
        args = parser.parse_args()
    Python
    - Registered: Wed May 08 22:53:08 GMT 2024
    - Last Modified: Wed Mar 03 16:14:57 GMT 2021
    - 4.5K bytes
    - Viewed (0)
  9. fastapi/openapi/models.py

        contentSchema: Optional["SchemaOrBool"] = None
        # Ref: JSON Schema Validation 2020-12: https://json-schema.org/draft/2020-12/json-schema-validation.html#name-a-vocabulary-for-basic-meta
        # A Vocabulary for Basic Meta-Data Annotations
        title: Optional[str] = None
        description: Optional[str] = None
        default: Optional[Any] = None
        deprecated: Optional[bool] = None
        readOnly: Optional[bool] = None
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Thu Apr 18 22:49:33 GMT 2024
    - 15K bytes
    - Viewed (1)
  10. tests/test_response_model_as_return_annotation.py

    app = FastAPI()
    
    
    @app.get("/no_response_model-no_annotation-return_model")
    def no_response_model_no_annotation_return_model():
        return User(name="John", surname="Doe")
    
    
    @app.get("/no_response_model-no_annotation-return_dict")
    def no_response_model_no_annotation_return_dict():
        return {"name": "John", "surname": "Doe"}
    
    
    @app.get("/response_model-no_annotation-return_same_model", response_model=User)
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Mon Aug 14 09:49:57 GMT 2023
    - 47.7K bytes
    - Viewed (0)
Back to top