Giter Site home page Giter Site logo

Comments (8)

mansenfranzen avatar mansenfranzen commented on June 12, 2024 1

It got fixed with version 1.5.0 #51. Feel free to reopen if the issue still persists on your site.

from autodoc_pydantic.

mansenfranzen avatar mansenfranzen commented on June 12, 2024

@goroderickgo thanks for reporting the bug and the detailed report! Can you provide a minimal example of your pydantic model that causes the error, please? That would be great otherwise I'm having trouble to reproduce it. Additionally, can you check what pydantic version you are using? It could be related to a change in how pydantic stores and manages root validators.

from autodoc_pydantic.

goroderickgo avatar goroderickgo commented on June 12, 2024

OK! It will take me a couple days to get to this, but it's on my to-do list

from autodoc_pydantic.

mansenfranzen avatar mansenfranzen commented on June 12, 2024

I was able to identify the bug. Root validators come in two flavors via pre=True and pre=False. The default is pre=False which works just fine. However, the former using pre=True causes the error you've been experiencing. Hence, the following does currently not work with pydantic==1.8.2 and sphinx==4.2.0:

from pydantic import BaseModel, root_validator


class ExampleValidators(BaseModel):
    foobar: str

    @root_validator(pre=True)
    def validate_something(cls, values):
        return values

The fix is actually rather simple and will be included in the upcoming 1.5.0 release which will happen very soonish.

from autodoc_pydantic.

mansenfranzen avatar mansenfranzen commented on June 12, 2024

@goroderickgo PR #51 addresses your issue, among other things.

Before merging the related PR, it would be great if you could test the bug fix on your site to confirm that my test case did indeed capture the incorrect behavior which you've encountered. To do so, please install the current dev release in your doc-building-environment via pip install git+git://github.com/mansenfranzen/[email protected] and rebuild your docs.

from autodoc_pydantic.

mansenfranzen avatar mansenfranzen commented on June 12, 2024

@all-contributors please add @goroderickgo for tests

from autodoc_pydantic.

allcontributors avatar allcontributors commented on June 12, 2024

@mansenfranzen

I've put up a pull request to add @goroderickgo! 🎉

from autodoc_pydantic.

goroderickgo avatar goroderickgo commented on June 12, 2024

Thanks (and sorry I didn't get to posting more help before you made the fix)! Looks like the update here does fix the issue for me!

from autodoc_pydantic.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.