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

Calcium integration #258

Merged
merged 3 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<parent>
<groupId>io.lighty.core</groupId>
<artifactId>lighty-parent</artifactId>
<version>19.0.0</version>
<version>20.0.0</version>
<relativePath/>
</parent>

Expand Down
17 changes: 9 additions & 8 deletions src/main/java/io/lighty/yang/validator/YangContextFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@
import org.opendaylight.yangtools.yang.common.YangConstants;
import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
import org.opendaylight.yangtools.yang.model.api.Module;
import org.opendaylight.yangtools.yang.model.api.source.YangTextSource;
import org.opendaylight.yangtools.yang.model.api.stmt.FeatureSet;
import org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource;
import org.opendaylight.yangtools.yang.model.spi.source.FileYangTextSource;
import org.opendaylight.yangtools.yang.parser.api.YangParser;
import org.opendaylight.yangtools.yang.parser.api.YangParserException;
import org.opendaylight.yangtools.yang.parser.api.YangParserFactory;
Expand Down Expand Up @@ -70,17 +71,17 @@ EffectiveModelContext createContext(final boolean useAllFiles) throws IOExceptio

final List<String> names = new ArrayList<>();
for (final File file : testFiles) {
final YangTextSchemaSource yangTextSchemaSource = YangTextSchemaSource.forPath(file.toPath());
names.add(yangTextSchemaSource.getIdentifier().name().getLocalName());
parser.addSource(yangTextSchemaSource);
final YangTextSource yangTextSource = new FileYangTextSource(file.toPath());
names.add(yangTextSource.sourceId().name().getLocalName());
parser.addSource(yangTextSource);
}
for (final File file : libFiles) {
final YangTextSchemaSource yangTextSchemaSource = YangTextSchemaSource.forPath(file.toPath());
if (!names.contains(yangTextSchemaSource.getIdentifier().name().getLocalName())) {
final YangTextSource yangTextSource = new FileYangTextSource(file.toPath());
if (!names.contains(yangTextSource.sourceId().name().getLocalName())) {
if (useAllFiles) {
parser.addSource(yangTextSchemaSource);
parser.addSource(yangTextSource);
} else {
parser.addLibSource(YangTextSchemaSource.forPath(file.toPath()));
parser.addLibSource(new FileYangTextSource(file.toPath()));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public TrackingXmlParserStream parse(final XMLStreamReader reader) throws XMLStr
if (reader.hasNext()) {
reader.nextTag();
final var nodeDataWithSchema = AbstractNodeDataWithSchema.of(parentNode);
final SchemaInferenceStack schemaIS = SchemaInferenceStack.of(codecs.getEffectiveModelContext());
final SchemaInferenceStack schemaIS = SchemaInferenceStack.of(codecs.modelContext());
read(reader, nodeDataWithSchema, reader.getLocalName(), tree, schemaIS);
nodeDataWithSchema.write(writer);
}
Expand Down
Loading