The template name used by ietf-restconf:yang-data is supposed to be unique within an EffectiveModuleStatement, i.e. this is invalid:
module foo { import ietf-restconf { prefix rc; } rc:yang-data some { container foo; } rc:yang-data some { container bar; } }
We should be rejecting this construct due to template name conflict. Make sure YangDataStatementSupport maintains a dedicated ParserNamespace<String, StmtCtx> keyed by the statement argument. This should be backed by NamespaceBehaviour.statementLocal() stored at the statement's parent.
Also make sure module/submodule conflicts are detected properly.