Skip to content
Snippets Groups Projects
Commit 4ddb9f21 authored by Alexander Turenko's avatar Alexander Turenko Committed by Alexander Turenko
Browse files

config/schema: store parent's annotations in nodes

Sometimes we need to know somethings about ancestor nodes during
processing of a current node.

Now, the `<schema node>.computed.annotations` table represents all the
annotations from the root of the schema down to the given schema node
merged into a flat table. If the same named annotation met several times
on the path, the descendant value is preferred.

This computed annotations table is available everywhere, where the
schema node is returned or passed as a callback's argument. For example,
in values of the `<schema>:pairs()` iterator and in the `validate()`
schema node's callback.

It will be used in one of the next commits this way:

```lua
for _, w in instance_config:pairs() do
    if w.schema.computed.annotations.enterprise_edition then
        <...>
    else
        <...>
    end
end
```

Part of #8862

NO_DOC=the schema module is internal, at least now
NO_CHANGELOG=see NO_DOC
parent d69aa687
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment