|
@ -30,14 +30,14 @@ class ModelDefaults(BaseModel): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.get("/", response_model=Model, response_model_exclude_unset=True) |
|
|
@app.get("/", response_model=Model, response_model_exclude_unset=True) |
|
|
def get() -> ModelSubclass: |
|
|
def get_root() -> ModelSubclass: |
|
|
return ModelSubclass(sub={}, y=1, z=0) |
|
|
return ModelSubclass(sub={}, y=1, z=0) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.get( |
|
|
@app.get( |
|
|
"/exclude_unset", response_model=ModelDefaults, response_model_exclude_unset=True |
|
|
"/exclude_unset", response_model=ModelDefaults, response_model_exclude_unset=True |
|
|
) |
|
|
) |
|
|
def get() -> ModelDefaults: |
|
|
def get_exclude_unset() -> ModelDefaults: |
|
|
return ModelDefaults(x=None, y="y") |
|
|
return ModelDefaults(x=None, y="y") |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -46,14 +46,14 @@ def get() -> ModelDefaults: |
|
|
response_model=ModelDefaults, |
|
|
response_model=ModelDefaults, |
|
|
response_model_exclude_defaults=True, |
|
|
response_model_exclude_defaults=True, |
|
|
) |
|
|
) |
|
|
def get() -> ModelDefaults: |
|
|
def get_exclude_defaults() -> ModelDefaults: |
|
|
return ModelDefaults(x=None, y="y") |
|
|
return ModelDefaults(x=None, y="y") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.get( |
|
|
@app.get( |
|
|
"/exclude_none", response_model=ModelDefaults, response_model_exclude_none=True |
|
|
"/exclude_none", response_model=ModelDefaults, response_model_exclude_none=True |
|
|
) |
|
|
) |
|
|
def get() -> ModelDefaults: |
|
|
def get_exclude_none() -> ModelDefaults: |
|
|
return ModelDefaults(x=None, y="y") |
|
|
return ModelDefaults(x=None, y="y") |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -63,7 +63,7 @@ def get() -> ModelDefaults: |
|
|
response_model_exclude_unset=True, |
|
|
response_model_exclude_unset=True, |
|
|
response_model_exclude_none=True, |
|
|
response_model_exclude_none=True, |
|
|
) |
|
|
) |
|
|
def get() -> ModelDefaults: |
|
|
def get_exclude_unset_none() -> ModelDefaults: |
|
|
return ModelDefaults(x=None, y="y") |
|
|
return ModelDefaults(x=None, y="y") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|