Ecto schema reflection function clauses: Are some of them private?

The Ecto.Schema docs list some functions that can be used for reflection, e.g. schema.__schema__(:fields).

However, there are some additional clauses in the source code that are not listed in the previously-mentioned docs page, e.g. schema.__schema__(:updatable_fields).

Should I assume that any clause not present in the docs is part of the private API, which could change at any time? Or can I use them all freely?

5 Likes

Both! :lol:

Naw I’m just kidding, it’s a good question. I always assume if It’s not documented it’s private, but it could be an oversight. It’s too bad there’s no way to do the equivalent of @doc false for matches.

2 Likes

Just giving this a little bump in the hopes that someone else might see it who can provide some insight. :slight_smile:

If this doesn’t work, I might just open a quick issue on GitHub so that this question doesn’t need to come up again in the future.

EDIT: Sorry Brother @sodapopcan, I didn’t mean to reply directly to you. :sweat_smile:

1 Like

That’s all good! I was also hoping someone would give a decisive answer.

1 Like

OK so the answer is “Yes, any non-listed one is private.”

3 Likes

IMO not private as in “impossible to access”, but more like “undocumented and subject to change at any time, use at your own risk”. I realize the updated docs say that but “private” is used in the issue so I felt I had to clarify.

2 Likes

Ah, a subtle but relevant distinction.

Thanks for the clarification, I always get the terms wrong.

1 Like