pydantic / pydantic-extra-types

Extra Pydantic types.
MIT License
181 stars 48 forks source link

Add: New type ISBN #116

Closed lucasmucidas closed 8 months ago

lucasmucidas commented 8 months ago

Implementation of issue-115


ISBN

The pydantic_extra_types.isbn module provides functionality to receive and validate ISBN (International Standard Book Number) in 10-digit and 13-digit formats. The output is always ISBN-13.

Using

    from pydantic import BaseModel

    from pydantic_extra_types.isbn import ISBN

    class Book(BaseModel):
        isbn: ISBN

    book = Book(isbn="8537809667")
    print(book)

output:

#> isbn='9788537809662'

Coverage

image

Selected Reviewer: @yezz123

codecov[bot] commented 8 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (0ce9f20) 100.00% compared to head (630ef92) 100.00%. Report is 2 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #116 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 9 10 +1 Lines 642 688 +46 Branches 159 176 +17 ========================================= + Hits 642 688 +46 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

yezz123 commented 8 months ago

please review

yezz123 commented 8 months ago

hey @lucasmucidas can you fix the formatting issue in the code 🙏🏻

lucasmucidas commented 8 months ago

Sorry @yezz123, i think that's ok rn.

About the docs on pydantic main repo: What should i do?