Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc improve objects guide with extraction and composition patterns #991

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Bilboramix
Copy link

On the discord server we've seen few questions about how to extract a field's schema from an object.
Fabian suggested to explain it in the objects guide so here it is.

@fabian-hiller
Copy link
Owner

Thank you very much! I think I would move it before the ## Record schema heading and use a level 3 heading with ### for the sections you added. What do you think?

@fabian-hiller fabian-hiller self-assigned this Dec 22, 2024
@fabian-hiller fabian-hiller added the documentation Improvements or additions to documentation label Dec 22, 2024
@Bilboramix
Copy link
Author

Yes this sounds good to me,
Also, at first i added an example with array but then i noticed that array is not mentioned at all in the objects guide.

That make sense as there's a dedicated guide about arrays on the next page. This being said i could add similar sections to the array guide as the way to access nested schema change between the two.

@fabian-hiller
Copy link
Owner

Another option would be to add an extra guide explaining the accessibility of schemas in general instead of adding it everywhere.

@Bilboramix
Copy link
Author

Yeah that can make sense. I can change to this idea.
How would you name the page ?
I think about putting it in the "main concept" section of the guides, after Pipeline. But i hesitate on the name... Guessed about"Schema insights" or "Composition" (I like this one as we could also explore reusability of the pipe function)

@fabian-hiller
Copy link
Owner

We could also call this guide "Internals" or something else in that direction. At the time of implementation, we called it the "Schema Reflection API". On the other hand, I think library authors and hardcore users will be most interested in this guide. I don't have a perfect title yet, but I recommend that I write the first version of this guide as I have the most knowledge on this regards. But I am happy to create a PR and receive feedback before publishing it.

@Bilboramix
Copy link
Author

I think "Reflection" could be a good name, internal sounds weird to me but maybe because i'm not a native english speaker.
Put it in "Advanced" section sound also good to me.
Though i believe that most of the things about composition and reusability of the schemas should be accessible easily as it can greatly improve the DX and the feeling about the lib.
As you want, let's do that, then you can close this PR. I'll be happy to review, do not hesitate to ping me on it.

@fabian-hiller
Copy link
Owner

Let's see how it goes. Maybe we merge this PR too to add some info to the objects guide in addition.

@Bilboramix
Copy link
Author

Bilboramix commented Dec 23, 2024

Yeah ok. For more advanced use cases we could put a link to the next guide here maybe, to avoid too much repetitive content.
I also though that maybe a place where we have some playgrounds links could be nice to avoid content duplication.
Something like this :

How to :

Use a composition pattern

Use an extraction pattern

And so on...

I realize the responsibility you got as an author to pick the right descisions and to compose with what the community want, all the ideas submitted and ensure that the lib and the doc keep a good quality. Massive respect !

@fabian-hiller
Copy link
Owner

I also though that maybe a place where we have some playgrounds links could be nice to avoid content duplication.

Great idea! I agree there is room for improvement. In the long run we should add a "copy" button to the code examples and maybe also an "open in playground" button.

I realize the responsibility you got as an author to pick the right descisions and to compose with what the community want, all the ideas submitted and ensure that the lib and the doc keep a good quality. Massive respect !

Thank you very much! Yes, it is not always an easy task. With more and more users, the responsibility also increases. That's why I have to slow down a lot of decisions. Prioritizing the right things and keeping an eye on quality will be very important for the success of the project in the long run.

@fabian-hiller
Copy link
Owner

The "Reflection API" guide is on my list, but I can't tell you when I will find the time to write it. Right now I am trying to focus on important fixes and getting Valibot v1 RC ready.

@fabian-hiller
Copy link
Owner

Related issue: #256

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants