Giter Site home page Giter Site logo

Comments (7)

mansenfranzen avatar mansenfranzen commented on June 12, 2024 1

Hi @nchaly,

thanks a lot for reporting this bug at such detailed level. It made it very is to reproduce.

It is definitely a bug due to an unhandled edge case. I will get back to you soon.

from autodoc_pydantic.

nchaly avatar nchaly commented on June 12, 2024 1

@mansenfranzen I agree. In fact current behaviour creates a duplicate block of data, which confused me the first time I saw it - it looked at a first glance as if DataTransformer itself has now got its own schema.

So yes, a reference to the original pydantic model should be fine.

image

from autodoc_pydantic.

mansenfranzen avatar mansenfranzen commented on June 12, 2024 1

I merged the changes in the v1.6.0 release. There is a FAQ section in the updated documentation describing your issue. Feel free to reopen or comment. Thanks for reporting this once again.

from autodoc_pydantic.

mansenfranzen avatar mansenfranzen commented on June 12, 2024

It turns out that the bug is not difficult to fix. However, which is more important, your example reveals a more general question. How should autodoc_pydantic document pydantic models/settings which are used as class attributes just like in your example.

While autodocumenting DataTransformer it is not relevant to show every detail of PARAMS_CLS (like json schema, field and validator summary lists etc...). Instead, only a short description is enough. The main focus is on DataTransformer in its entirety and not on the most detailed documentation of all its individual potentially complex attributes.

Moreover, when DataTransformerConfig is used as an attribute, sphinx automatically adds a link to its main auto-documentation section which allows deep dive inspection. That's yet another reason why a brief description is sufficient.

Hence, I suggest to remove all additional sections such as json schema, field & validator summary lists and config summary from pydantic models/settings if they are documented as an attribute. What do you think?

This will also automatically resolve the bug you're experiencing.

from autodoc_pydantic.

mansenfranzen avatar mansenfranzen commented on June 12, 2024

#79 addresses the issue.

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 @nchaly for bug and tests

from autodoc_pydantic.

allcontributors avatar allcontributors commented on June 12, 2024

@mansenfranzen

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

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.