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

Make Schema Tree public #895

Merged
merged 6 commits into from
Jul 26, 2023
Merged

Make Schema Tree public #895

merged 6 commits into from
Jul 26, 2023

Conversation

Ankur19
Copy link
Contributor

@Ankur19 Ankur19 commented Jul 25, 2023

I would like to build the SchemaTree using yang Entries and then use the ResolveLeafRefTarget method to calculate the actual data type of a leafref.

@Ankur19
Copy link
Contributor Author

Ankur19 commented Jul 25, 2023

@wenovus Please review.

@coveralls
Copy link

coveralls commented Jul 25, 2023

Coverage Status

coverage: 89.603% (-0.05%) from 89.649% when pulling 291ec5d on Ankur19:master into 9ceedc0 on openconfig:master.

@wenovus
Copy link
Collaborator

wenovus commented Jul 25, 2023

@Ankur19 Does https://github.com/openconfig/goyang/blob/1d9b70a64cbe8e0ba42f95ab5c4e1ea81ac17c19/pkg/yang/entry.go#L1310 work? I'm assuming you're working with goyang structs so if the use case is not ygot-specific then goyang should be satisfying the need.

@Ankur19
Copy link
Contributor Author

Ankur19 commented Jul 26, 2023

@Ankur19 Does https://github.com/openconfig/goyang/blob/1d9b70a64cbe8e0ba42f95ab5c4e1ea81ac17c19/pkg/yang/entry.go#L1310 work? I'm assuming you're working with goyang structs so if the use case is not ygot-specific then goyang should be satisfying the need.

Let me check. Thanks for the pointer.

@Ankur19
Copy link
Contributor Author

Ankur19 commented Jul 26, 2023

@Ankur19 Does https://github.com/openconfig/goyang/blob/1d9b70a64cbe8e0ba42f95ab5c4e1ea81ac17c19/pkg/yang/entry.go#L1310 work? I'm assuming you're working with goyang structs so if the use case is not ygot-specific then goyang should be satisfying the need.

The Find method returns a null pointer for a few Paths.

e.g. /oc-netinst:network-instances/oc-netinst:network-instance/oc-netinst:config/oc-netinst:name

Copy link
Collaborator

@wenovus wenovus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exporting this functionality looks fine to me since it provides handling that goyang's Entry.Find doesn't have.

Can you put it in a separate package called yangschema? Then we can rename the type to yangschema.Tree.

@Ankur19
Copy link
Contributor Author

Ankur19 commented Jul 26, 2023

Exporting this functionality looks fine to me since it provides handling that goyang's Entry.Find doesn't have.

Can you put it in a separate package called yangschema? Then we can rename the type to yangschema.Tree.

Done!

yangschema/yangschema.go Outdated Show resolved Hide resolved
@wenovus wenovus merged commit ca98dd5 into openconfig:master Jul 26, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants