Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for mandel2 (0.22 sec)

  1. tests/test_response_model_as_return_annotation.py

    
    @app.get(
        "/response_model_model1-annotation_model2-return_same_model", response_model=User
    )
    def response_model_model1_annotation_model2_return_same_model() -> Item:
        return User(name="John", surname="Doe")
    
    
    @app.get(
        "/response_model_model1-annotation_model2-return_exact_dict", response_model=User
    )
    def response_model_model1_annotation_model2_return_exact_dict() -> Item:
    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)
  2. tests/test_duplicate_models_openapi.py

    from fastapi import FastAPI
    from fastapi.testclient import TestClient
    from pydantic import BaseModel
    
    app = FastAPI()
    
    
    class Model(BaseModel):
        pass
    
    
    class Model2(BaseModel):
        a: Model
    
    
    class Model3(BaseModel):
        c: Model
        d: Model2
    
    
    @app.get("/", response_model=Model3)
    def f():
        return {"c": {}, "d": {"a": {}}}
    
    
    client = TestClient(app)
    
    
    def test_get_api_route():
    Python
    - Registered: Sun May 05 07:19:11 GMT 2024
    - Last Modified: Fri Jun 30 18:25:16 GMT 2023
    - 2.1K bytes
    - Viewed (0)
Back to top