Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 12 for json_encoders (0.13 sec)

  1. tests/test_datetime_custom_encoder.py

    
    # TODO: remove when deprecating Pydantic v1
    @needs_pydanticv1
    def test_pydanticv1():
        class ModelWithDatetimeField(BaseModel):
            dt_field: datetime
    
            class Config:
                json_encoders = {
                    datetime: lambda dt: dt.replace(
                        microsecond=0, tzinfo=timezone.utc
                    ).isoformat()
                }
    
        app = FastAPI()
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Fri Jul 07 17:12:13 UTC 2023
    - 1.6K bytes
    - Viewed (0)
  2. docs/de/docs/tutorial/extra-data-types.md

        * Wird in Requests und Responses als `float` der Gesamtsekunden dargestellt.
        * Pydantic ermöglicht auch die Darstellung als „ISO 8601 Zeitdifferenz-Kodierung“, <a href="https://docs.pydantic.dev/1.10/usage/exporting_models/#json_encoders" class="external-link" target="_blank">Weitere Informationen finden Sie in der Dokumentation</a>.
    * `frozenset`:
        * Wird in Requests und Responses wie ein `set` behandelt:
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 4.3K bytes
    - Viewed (0)
  3. tests/test_inherited_custom_class.py

                vars(asyncpg_uuid)
            return {"fast_uuid": asyncpg_uuid}
    
        class SomeCustomClass(BaseModel):
            class Config:
                arbitrary_types_allowed = True
                json_encoders = {uuid.UUID: str}
    
            a_uuid: MyUuid
    
        @app.get("/get_custom_class")
        def return_some_user():
            # Test that the fix also works for custom pydantic classes
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sat Aug 17 04:13:50 UTC 2024
    - 3K bytes
    - Viewed (0)
  4. docs/ru/docs/tutorial/extra-data-types.md

        * Pydantic также позволяет представить его как "Кодировку разницы во времени ISO 8601", <a href="https://docs.pydantic.dev/latest/concepts/serialization/#json_encoders" class="external-link" target="_blank">см. документацию для получения дополнительной информации</a>.
    * `frozenset`:
        * В запросах и ответах обрабатывается так же, как и `set`:
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 4.7K bytes
    - Viewed (0)
  5. docs/em/docs/tutorial/extra-data-types.md

    * `datetime.timedelta`:
        * 🐍 `datetime.timedelta`.
        * 📨 &amp; 📨 🔜 🎨 `float` 🌐 🥈.
        * Pydantic ✔ 🎦 ⚫️ "💾 8️⃣6️⃣0️⃣1️⃣ 🕰 ➕ 🔢", <a href="https://docs.pydantic.dev/latest/concepts/serialization/#json_encoders" class="external-link" target="_blank">👀 🩺 🌅 ℹ</a>.
    * `frozenset`:
        * 📨 &amp; 📨, 😥 🎏 `set`:
            * 📨, 📇 🔜 ✍, ❎ ❎ &amp; 🏭 ⚫️ `set`.
            * 📨, `set` 🔜 🗜 `list`.
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 2.6K bytes
    - Viewed (0)
  6. docs/uk/docs/tutorial/extra-data-types.md

        * У запитах та відповідях буде представлений як `float` загальної кількості секунд.
        * Pydantic також дозволяє представляти це як "ISO 8601 time diff encoding", <a href="https://docs.pydantic.dev/latest/concepts/serialization/#json_encoders" class="external-link" target="_blank">більше інформації дивись у документації</a>.
    * `frozenset`:
        * У запитах і відповідях це буде оброблено так само, як і `set`:
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 5.8K bytes
    - Viewed (0)
  7. docs/zh/docs/tutorial/extra-data-types.md

    * `datetime.timedelta`:
        * 一个 Python `datetime.timedelta`.
        * 在请求和响应中将表示为 `float` 代表总秒数。
        * Pydantic 也允许将其表示为 "ISO 8601 时间差异编码", <a href="https://docs.pydantic.dev/latest/concepts/serialization/#json_encoders" class="external-link" target="_blank">查看文档了解更多信息</a>。
    * `frozenset`:
        * 在请求和响应中,作为 `set` 对待:
            * 在请求中,列表将被读取,消除重复,并将其转换为一个 `set`。
            * 在响应中 `set` 将被转换为 `list` 。
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 3.9K bytes
    - Viewed (0)
  8. docs/ko/docs/tutorial/extra-data-types.md

    * `datetime.timedelta`:
        * 파이썬의 `datetime.timedelta`.
        * 요청과 응답에서 전체 초(seconds)의 `float`로 표현됩니다.
        * Pydantic은 "ISO 8601 시차 인코딩"으로 표현하는 것 또한 허용합니다. <a href="https://docs.pydantic.dev/latest/concepts/serialization/#json_encoders" class="external-link" target="_blank">더 많은 정보는 이 문서에서 확인하십시오.</a>.
    * `frozenset`:
        * 요청과 응답에서 `set`와 동일하게 취급됩니다:
            * 요청 시, 리스트를 읽어 중복을 제거하고 `set`로 변환합니다.
            * 응답 시, `set`는 `list`로 변환됩니다.
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Sun Oct 06 20:36:54 UTC 2024
    - 4.3K bytes
    - Viewed (0)
  9. tests/test_jsonable_encoder.py

    @needs_pydanticv1
    def test_encode_custom_json_encoders_model_pydanticv1():
        class ModelWithCustomEncoder(BaseModel):
            dt_field: datetime
    
            class Config:
                json_encoders = {
                    datetime: lambda dt: dt.replace(
                        microsecond=0, tzinfo=timezone.utc
                    ).isoformat()
                }
    
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Apr 18 21:56:59 UTC 2024
    - 9K bytes
    - Viewed (0)
  10. fastapi/encoders.py

        if isinstance(obj, BaseModel):
            # TODO: remove when deprecating Pydantic v1
            encoders: Dict[Any, Any] = {}
            if not PYDANTIC_V2:
                encoders = getattr(obj.__config__, "json_encoders", {})  # type: ignore[attr-defined]
                if custom_encoder:
                    encoders.update(custom_encoder)
            obj_dict = _model_dump(
                obj,
                mode="json",
    Registered: Sun Nov 03 07:19:11 UTC 2024
    - Last Modified: Thu Apr 18 21:56:59 UTC 2024
    - 10.8K bytes
    - Viewed (0)
Back to top