Title: typedef only returns value if prefixed/imported type · Issue #153 · CESNET/libyang-python · GitHub
Open Graph Title: typedef only returns value if prefixed/imported type · Issue #153 · CESNET/libyang-python
X Title: typedef only returns value if prefixed/imported type · Issue #153 · CESNET/libyang-python
Description: Hi, I think there is an issue with the implement of the typedef function of the Type class. If seems to only assume a ":" will be present in the type, but from my understanding this will only be the case for type that are imported from a...
Open Graph Description: Hi, I think there is an issue with the implement of the typedef function of the Type class. If seems to only assume a ":" will be present in the type, but from my understanding this will only be th...
X Description: Hi, I think there is an issue with the implement of the typedef function of the Type class. If seems to only assume a ":" will be present in the type, but from my understanding this will ...
Opengraph URL: https://github.com/CESNET/libyang-python/issues/153
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"typedef only returns value if prefixed/imported type","articleBody":"Hi,\n\nI think there is an issue with the implement of the **typedef** function of the **Type** class.\n\nIf seems to only assume a \":\" will be present in the type, but from my understanding this will only be the case for type that are imported from another yang schema:\n\nhttps://github.com/CESNET/libyang-python/blob/3072af036386a6bb0fde285eba751e09a4948261/libyang/schema.py#L656-L662\n\nFor instance with this schema, my \"operation-status\" enumeration was not found properly.\n\n```yang\nmodule my_imported_module {\n namespace \"urn:ietf:params:xml:ns:yang:my-imported-module\";\n prefix \"my-imported-module\";\n\n typedef operation-status {\n type enumeration {\n enum \"inactive\" {\n description \"The operation is currently inactive and not running\";\n }\n enum \"active\" {\n description \"The operation is currently active and running normally\";\n }\n enum \"pending\" {\n description \"The operation is pending and waiting to be started\";\n }\n enum \"error\" {\n description \"The operation has encountered an error and requires attention\";\n }\n enum \"maintenance\" {\n description \"The operation is under maintenance and temporarily unavailable\";\n }\n }\n description \"Enumeration representing the operational status of a service or component\";\n }\n\n grouping my-imported-container {\n container my-imported-container {\n leaf custom-leaf-config-true {\n config true;\n type string;\n }\n leaf custom-leaf-config-false {\n config false;\n type string;\n }\n\n leaf operation-status {\n type operation-status;\n description \"Requested operational status of this specific service instance in the container\";\n }\n }\n }\n}\n\n```\n\n\nI had to do a \"double-pass\", with a search using the typedef first, then adding a search in the local module, like so:\n\n```python\n def typedef(self) -\u003e YangTypedef:\n external_typedef = self.type.typedef()\n if external_typedef is not None:\n return YangTypedef(external_typedef)\n\n # There is a bug in default get_typedef: it only searches in external modules using a prefix\n internal_typedef = self.type.module().get_typedef(self.type.name())\n return YangTypedef(internal_typedef) if internal_typedef is not None else None\n```\n\nis my understanding correct ?","author":{"url":"https://github.com/Krisscut","@type":"Person","name":"Krisscut"},"datePublished":"2025-09-24T15:42:50.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/153/libyang-python/issues/153"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:a7d8489e-4568-b1fd-e259-b9fe4a5b4c75 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CD36:24B4CE:12FD14B:1A2B370:6969FFB4 |
| html-safe-nonce | 17d0c61441a41539ea65258dcda1438886e10e5e2851e29666f621af38d0a8b0 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRDM2OjI0QjRDRToxMkZEMTRCOjFBMkIzNzA6Njk2OUZGQjQiLCJ2aXNpdG9yX2lkIjoiNjc3OTE4NzI2MDkyNzExNTE4OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 43a6216c30353b20bacd391d93e7e202b9aa633464acf879f095ad1472bbd99d |
| hovercard-subject-tag | issue:3449982012 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/CESNET/libyang-python/153/issue_layout |
| twitter:image | https://opengraph.githubassets.com/81d21ab20da57c2f16e40ad8b904aebb9ca2ea65e9dbed48dceacf32e04c191b/CESNET/libyang-python/issues/153 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/81d21ab20da57c2f16e40ad8b904aebb9ca2ea65e9dbed48dceacf32e04c191b/CESNET/libyang-python/issues/153 |
| og:image:alt | Hi, I think there is an issue with the implement of the typedef function of the Type class. If seems to only assume a ":" will be present in the type, but from my understanding this will only be th... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Krisscut |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7b32f1c7c4549428ee399213e8345494fc55b5637195d3fc5f493657579235e8 |
| turbo-cache-control | no-preview |
| go-import | github.com/CESNET/libyang-python git https://github.com/CESNET/libyang-python.git |
| octolytics-dimension-user_id | 1116469 |
| octolytics-dimension-user_login | CESNET |
| octolytics-dimension-repository_id | 275748507 |
| octolytics-dimension-repository_nwo | CESNET/libyang-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 275748507 |
| octolytics-dimension-repository_network_root_nwo | CESNET/libyang-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | bdde15ad1b403e23b08bbd89b53fbe6bdf688cad |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width