A YANG-centric Go toolkit - Go/Protobuf Code Generation; Validation; Marshaling/Unmarshaling


Go Coverage Status Go releases supported



ygot (YANG Go Tools) is a collection of Go utilities that can be used to:

  • Generate a set of Go structures and enumerated values for a set of YANG modules, with associated helper methods.
  • Validate the contents of the Go structures against the YANG schema (e.g., validating range and regular expression constraints).
  • Render the Go structures to an output format - such as JSON, or a set of gNMI Notifications for use in a deployment of streaming telemetry.

Whilst ygot is designed to work with any YANG module, for OpenConfig modules, it can provide transformations of the schema to optimise the data structures that are produced for use in systems that generate data instances of the models for configuration purposes. These helper methods require that the OpenConfig style guide patterns are implemented, a model can be verified to conform with these requirements using the OpenConfig linter.

Note: This is not an official Google product.

Getting Started with ygot

Current support for ygot is for the latest 3 Go releases.

ygot consists of a number of parts, generator which is a binary using the ygen library to generate Go code from a set of YANG modules. ygot which provides helper methods for the ygen-produced structs - for example, rendering to JSON, or gNMI notifications - and ytypes which provides validation of the contents of ygen structs against the YANG schema.

The basic workflow for working with ygot is as follows:

  • Generate Go code from a set of YANG files.
  • Write code that populates the Go structures.
  • Validate the contents of the Go structures.
  • Output the contents of the structures as JSON or gNMI Notifications.

The demo/getting_started directory walks through this process for a simple implementation of openconfig-interfaces.

Generating Go Structures from YANG

The generator binary takes a set of YANG modules as input and outputs generated code. For example:

generator -output_file=<outputpath> -package_name=<pkg> [yangfiles]

Will output generated Go code for yangfiles (a space separated list of YANG files) to a file at <outputpath> with the Go package named <pkg>.

Most YANG modules include other modules. If these included modules are not within the current working directory, the path argument is used. The argument to path is a comma-separated list of directories which will be recursively searched for included files.

By default, ygot does not output an entity for the root of the schema tree - such that there is not a root entity to consider in code. If one is desired then it can be produced by using the generate_fakeroot argument. If specified an element with the name specified by fakeroot_name will be created in the output code. By default the fake root element is called device, since the root is often considered to be a device within the OpenConfig use case.

If schema transformations for OpenConfig are desired, these are enabled using the compress_paths argument.

Putting this all together, a command line to generate OpenConfig interfaces from the contents of the demo/getting_started/yang directory is:

go run $GOPATH/src/github.com/openconfig/ygot/generator/generator.go -path=yang -output_file=pkg/ocdemo/oc.go -package_name=ocdemo -generate_fakeroot -fakeroot_name=device -compress_paths=true -shorten_enum_leaf_names -typedef_enum_with_defmod -exclude_modules=ietf-interfaces yang/openconfig-interfaces.yang

To allow this file to be auto-created, you can place a command which allows this code generation to be done automatically, either by creating a file within the YANG directory, or directly embedding this command within the source file that populates the structures. For an example, see the demo/getting_started/main.go file which includes:

//go:generate go run ../../generator/generator.go -path=yang -output_file=pkg/ocdemo/oc.go -package_name=ocdemo -generate_fakeroot -fakeroot_name=device -compress_paths=true -shorten_enum_leaf_names -typedef_enum_with_defmod -exclude_modules=ietf-interfaces yang/openconfig-interfaces.yang

This means that we can simply type go generate within demo/getting_started - and the demo/getting_started/pkg/ocdemo/oc.go is created with the code bindings for the OpenConfig interfaces module.

Writing Code that Populates the Go Structures

Once we have generated the Go bindings for the YANG module, we're ready to use them in an application.

First, let's take a look at what the demo/getting_started/pkg/ocdemo/oc.go file contains. Particularly, looking at the fake root entity that we created (named device):

// Device represents the /device YANG schema element.
type Device struct {
        Interface       map[string]*Interface   `path:"interfaces/interface" rootname:"interface" module:"openconfig-interfaces"`

Since we enabled compress_paths, then the /interfaces/interface element in OpenConfig was represented as Interface at the root (called Device). We can see that since interface is a list, keyed by the name element, then the Interface map is keyed by a string.

Looking further down the tree at Interface:

// Interface represents the /openconfig-interfaces/interfaces/interface YANG schema element.
type Interface struct {
        AdminStatus  E_OpenconfigInterfaces_Interface_AdminStatus `path:"state/admin-status" module:"openconfig-interfaces"`
        Counters     *Interface_Counters                          `path:"state/counters" module:"openconfig-interfaces"`
        Description  *string                                      `path:"config/description" module:"openconfig-interfaces"`
        Enabled      *bool                                        `path:"config/enabled" module:"openconfig-interfaces"`
        HoldTime     *Interface_HoldTime                          `path:"hold-time" module:"openconfig-interfaces"`
        Ifindex      *uint32                                      `path:"state/ifindex" module:"openconfig-interfaces"`
        LastChange   *uint32                                      `path:"state/last-change" module:"openconfig-interfaces"`
        Mtu          *uint16                                      `path:"config/mtu" module:"openconfig-interfaces"`
        Name         *string                                      `path:"config/name|name" module:"openconfig-interfaces"`
        OperStatus   E_OpenconfigInterfaces_Interface_AdminStatus `path:"state/oper-status" module:"openconfig-interfaces"`
        Subinterface map[uint32]*Interface_Subinterface           `path:"subinterfaces/subinterface" module:"openconfig-interfaces"`
        Type         E_IETFInterfaces_InterfaceType               `path:"config/type" module:"openconfig-interfaces"`

Since OpenConfig path compression was enabled, then this Interface struct contains both direct descendants of /interfaces/interface - such as hold-time (in the Hold-Time field), along with those that were within the config and state fields. The path information is retained in the path struct tag -- but this isn't of interest to most developers working directly with the structs!

We can populate an interface by using a mixture of the helper methods, and directly setting fields of the struct. To create a new interface within the device, we can use the NewInterface method. A New... method is created for all lists within the YANG schema, and takes an argument of the key that is used for the list. It creates a new entry in the map with the specified key, returning an error if the key is already defined.

An example is shown below:

// Create a new interface called "eth0"
i, err := d.NewInterface("eth0")

// Set the fields that are within the struct.
i.AdminStatus = oc.OpenconfigInterfaces_Interface_AdminStatus_UP
i.Mtu = ygot.Uint16(1500)
i.Description = ygot.String("An Interface")

The ygot package provides helpers that allow an input type to returned as a pointer to be populated within the structs. For example, ygot.String returns a string pointer to the argument supplied.

Equally, we can define a new interface directly and add it to the map, without using the NewInterface method:

d.Interface["eth1"] = &oc.Interface{
	Name:        ygot.String("eth1"),
	Description: ygot.String("Another Interface"),
	Enabled:     ygot.Bool(false),
	Type:        oc.IETFInterfaces_InterfaceType_ethernetCsmacd,

Validating the Struct Contents

For some fields of the structures, enumerated values for example, values of fields are restricted such that they cannot have invalid values specified. In other cases, such as an IPv4 addresses, a string may not match a regular expression, but the Go structure does not restrict the contents of the struct being populated with this data.

By default each struct has a Validate method, this can be used to validate the struct's contents against the schema. Validate can be called against each structure, for example:

if err := d.Interface["eth0"].Validate(); err != nil {
	panic(fmt.Sprintf("Interface validation failed: %v", err))

In the case that the struct does not contain valid contents, Validate returns an error, containing a list of errors encountered during validation of the struct contents. Whilst the error can be directly handled as a comma-separated list of strings containing validation errors, casting it to the ytypes.Errors type allows handling of individual errors more cleanly. For example:

_, err = subif.Ipv4.NewAddress("Not a valid address")
if err := invalidIf.Validate(); err == nil {
	panic(fmt.Sprintf("Did not find invalid address, got nil err: %v", err))
} else {
	errs := err.(ytypes.Errors)
	for _, err := range errs {
		fmt.Printf("Got expected error: %v\n", err)	}

Outputting JSON from GoStructs

To serialise the structures to JSON, the ygot package provides an EmitJSON method which can be called with an arbitrary structure. In the example below, the fake root (Device) struct is called:

json, err := ygot.EmitJSON(d, &ygot.EmitJSONConfig{
	Format: ygot.RFC7951,
	Indent: "  ",
	RFC7951Config: &ygot.RFC7951JSONConfig{
		AppendModuleName: true,

if err != nil {
	panic(fmt.Sprintf("JSON demo error: %v", err))

EmitJSON performs both Validate and outputs the structure to JSON. The format can be an internal JSON format, or that described by RFC7951. Validation or JSON marshalling errors are directly returned.

Unmarshalling JSON to a GoStruct

ygot includes a function to unmarshal data from RFC7951-encoded JSON to a GoStruct. Since this function relies on the schema of the generated code, it us output within the generated code package - and named Unmarshal. The function takes an argument of a []byte (byte slice) containing the JSON document to be unmarshalled, and a pointer to the struct into which it should be unmarshalled. Any struct can be unmarshalled into. If data cannot be unmarshalled, an error is returned.

To unmarshal the example created in this guide, we call Unmarshal with the oc.Device struct pointer, and the JSON document:

// Device struct to unmarshal into.
loadd := &oc.Device{}
if err := oc.Unmarshal([]byte(json), loadd); err != nil {
  panic(fmt.Sprintf("Cannot unmarshal JSON: %v", err))

Currently, only the RFC7951 format of JSON is supported for unmarshalling, the Internal format supported by ygot is not yet supported.

For Developers

  • Contributing - how to contribute to ygot.
  • Contributors - Folks who have contributed to ygot, thanks very much!
  • Design Choices - This document provides information pertaining to design choices made within the library itself; and should be reviewed in conjunction with the comments in the library code.


Copyright 2017 Google Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at


Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.
  • Mechanism to access default values

    Mechanism to access default values

    It is common for a leaf node to have a default value (here is an example). If those nodes are unset, the current behavior is that the node is marked as unset (nil). This is not ideal as the Go code lost the information of the default value. I can think of two possible solutions to this.

    1. Provide an additional API for each node to access its default value (nil if there is no default value). Or
    2. Set the field to have the value of the default even if the field is unset.

    Option 2) has the drawback of losing the fact when a field is purposefully unset but either implementation would be a good step forward compared with the current behavior.

    opened by zhiweicen 20
  • panic: interface conversion: yang.Node is nil, not *yang.Module

    panic: interface conversion: yang.Node is nil, not *yang.Module

    I've stumbled onto a problem when calling ytypes.GetOrCreateNode(). The following is a chunk of my schema:

          list connectivity-service {
            key "connectivity-service";
            leaf connectivity-service {
              type leafref {
                path "/cs:connectivity-service/cs:connectivity-service/cs:id";
                "Link to connectivity services where configuration should be pushed for this enterprise's devices";

    We call ytypes.GetOrCreateNode() which in turn calls Find on the path /cs:connectivity-service/cs:connectivity-service/cs:id. This causes Find to backup to the root, and then it encounters Entries that have a Nil node. It's failing here:

                   # /go/src/github.com/onosproject/sdcore-adapter/vendor/github.com/openconfig/goyang/pkg/yang/entry.go:1249
    		// Since this module might use a different prefix that isn't
    		// the prefix that the module itself uses then we need to resolve
    		// the module into its local prefix to find it.
    		pfxMap := map[string]string{
    			// Seed the map with the local module - we use GetPrefix just
    			// in case the module is a submodule.
    			e.Node.(*Module).GetPrefix(): e.Prefix.Name, // crash here

    The entry e at the time of the crash looks like this:

    &{Parent:<nil> Node:<nil> Name:device Description: Default: Units: Errors:[] Kind:Directory Config:unset Prefix:<nil> Mandatory:unset Dir:map[access-profile:0xc000102d80 apn-profile:0xc000103800 connectivity-service:0xc0003a4780 enterprise:0xc0003a5200 qos-profile:0xc0003a5e00 security-profile:0xc0003a8a80 subscriber:0xc0003a9680 up-profile:0xc0003afe00] Key: Type:<nil> Exts:[] ListAttr:<nil> RPC:<nil> Identities:[] Augments:[] Augmented:[] Deviations:[] Deviate:map[] deviatePresence:{hasMinElements:false hasMaxElements:false} Uses:[] Extra:map[] Annotation:map[isFakeRoot:true schemapath:/ structname:Device] namespace:<nil>}

    Possibly a related issue over in the goyang tracker at https://github.com/openconfig/goyang/issues/97.

    opened by scottmbaker 15
  • Add handling for partial data tree validation for leafrefs.

    Add handling for partial data tree validation for leafrefs.

     * (M) ytypes/validate.go
       - Add a configuration struct to the ytypes library that allows
         some parameters relating to validation to be globally set for
         a caller. Particularly, this allows for enabling/disabling
         errors when a leafref points to a target leaf that does not
         exist. This is required for partial schema population..
     * (M) ytypes/leafref.go
     * (M) ytypes/leafref_test.go
       - Add functions to check whether errors should be thrown for
         leafref data errors. If data errors are not to be returned as
         errors, log this error occurring. Add test cases to check this.
     * (M) ytypes/schema_tests/validate_test.go
       - Add a test case that covers ignoring leafref data errors.
    opened by robshakir 13
  • rename Validate to ΛValidate

    rename Validate to ΛValidate

    To overcome the issues regarding shadowing a Validate yang leaf as mentioned in #642. This PR changes the name of the Validate function to YgotValidate(...). besides adjusting all the demos, tests and examples the following files contain the essential changes.

    • ygot/types.go
    • ygot/struct_validation_map.go
    • ygen/gogen.go

    Is there a chance this PR will be accepted? Or does anyone else have a different approach solving this issue without introducing this type of incompatibility?

    opened by steiler 12
  • Add option to exclude generating code (path structs and GoStructs) for modules in the search paths

    Add option to exclude generating code (path structs and GoStructs) for modules in the search paths

    This is the first step towards being able to easily generate a go package per yang module.

    I considered the option of adding an -include_modules flags that does the reverse of exclude_modules. I preferred this approach because this way you could generate a go package per folder in openconfig/public/release/models/* by calling generator -path=.. *.yang recursively in each folder.

    cla: yes infeasible 
    opened by DanG100 12
  • Unmarshal into OpenconfigInterfaces_Interfaces_Interface_Subinterfaces fails

    Unmarshal into OpenconfigInterfaces_Interfaces_Interface_Subinterfaces fails

    After retrieving Subinterfaces with gNMI call GetRequest, the following Unmarshal of JSON-IETF encoded information fails with the following error:

    got float64 type for field in-octets, expect string

    Here is the code Unmarshaling data.

    	o := oc_interfaces_ip.OpenconfigInterfaces_Interfaces_Interface_Subinterfaces{}
    	if err := oc_interfaces_ip.Unmarshal(u.GetVal().GetJsonIetfVal(), &o); err != nil {
    		if err != nil {
    			glog.Errorf("failed to unmarshal to Openconfig Interface struct with error: %+v", err)

    If I use vanila json.Unmarshal into map[string]interface{}, Unmarshal works fine and the information format and the content is what would be expected.

    Interfaces: map[subinterface:[map[index:0 openconfig-if-ip:ipv4:map[addresses:map[address:[map[ip: state:map[ip: origin:STATIC prefix-length:32]]]] state:map[counters:map[in-octets:0 in-pkts:0 out-octets:0 out-pkts:0]]] openconfig-if-ip:ipv6:map[addresses:map[address:[map[ip:2001:128:128:128::1 state:map[ip:2001:128:128:128::1 origin:STATIC prefix-length:128 status:PREFERRED]]]] state:map[counters:map[in-octets:0 in-pkts:0 out-octets:0 out-pkts:0]]]]]]
    opened by sbezverk 11
  • Add nested message generation to protobuf output.

    Add nested message generation to protobuf output.

    This CL changes the default behaviour of proto_generator to output nested messages, rather than per-schematree level packages. This has the advantage of keeping autocompletion working on the generated proto code, and requiring significantly fewer build targets. The nested_messages flag to proto_generator can be set to false to return to the previous behaviour, which is advantageous if one wants packages that can be imported to a particular level of the schema tree.

    Apologies for the large change, a lot is testdata.

    opened by robshakir 11
  • Add support for Delete generation.

    Add support for Delete generation.

    This commit adds:

    • A flag (GenerateDeleteMethod) to ygen that creates DeleteXXX() methods for lists within the output code.
    • Unit tests for the above in ygen.
    opened by idryzhov 10
  • Add gNMI PathElem support for render

    Add gNMI PathElem support for render

    This change adds support for the new gNMI PathElem type as a prefix and path format when rendering gNMI notifications. This change is made in a generally backwards compatible manner, but did require some changes to the public API.

    opened by robshakir 10
  • ygen: Option to include descriptions in generated schema

    ygen: Option to include descriptions in generated schema

    Currently YANG descriptions are dropped to reduce the size of generated schema. Sometimes the descriptions are needed in the generated schema. This patch adds the ability to specify an -include_descriptions flag on the generate command

    cla: yes 
    opened by SeanCondon 9
  • go get fails

    go get fails

    go get of ygot is failing since few days. Probably after commit 40a57e464acae3a5ea401b2c8a85e879540a092f.

    ~$ GOPATH=/tmp/go go get github.com/openconfig/ygot/ygot
    # github.com/openconfig/gnmi/proto/gnmi_ext
    src/github.com/openconfig/gnmi/proto/gnmi_ext/gnmi_ext.pb.go:47:11: undefined: "github.com/golang/protobuf/proto".ProtoPackageIsVersion4
    # github.com/openconfig/ygot/proto/yext
    src/github.com/openconfig/ygot/proto/yext/yext.pb.go:44:11: undefined: "github.com/golang/protobuf/proto".ProtoPackageIsVersion4
    # github.com/openconfig/ygot/proto/ywrapper
    src/github.com/openconfig/ygot/proto/ywrapper/ywrapper.pb.go:46:11: undefined: "github.com/golang/protobuf/proto".ProtoPackageIsVersion4
    ~$ go version
    go version go1.12.5 linux/amd64
    opened by sachinholla 9
  • Update to latest version of gnmi dependency

    Update to latest version of gnmi dependency

    The effect of this changes is that now ygot will marshal decimal64 as DoubleVal instead of FloatVal or DecimalVal.

    I will increment the minor version and announce this as a backwards-incompatible change.

    Note: The test uses float32 but this is never generated in Go code, so we didn't lose coverage.

    opened by wenovus 2
  • Issue with proto-generator

    Issue with proto-generator

    Hi, We are trying to come up with a OpenConfig compliant yang model for IPsec (I understand it is not supported by OpenConfig currently). Initial trial to generate proto file failed with what we had, so so went back to the original IETF file that it is based on, which is ietf-ipsec-ikeless. I see same problems there -- any thoughts on how to progress? Is this an issue in ygot's proto-generator or something specific to the yang model itself?

    [[email protected] ygot]# go run proto_generator/protogenerator.go   -generate_fakeroot  -path=yang -output_dir=output_dir   -package_name=openconfig -enum_package_name=enums   yang_files/ietf-ipsec-ikeless.yang
    F0901 11:34:52.577201 3340125 protogenerator.go:135] errors mapping element: [unimplemented type in scalar generation: bits]
    exit status 1
    [[email protected] ygot]#
    opened by 5abeel 1
  • func EmitJSON is broken due to backwards compatability issue

    func EmitJSON is broken due to backwards compatability issue

    Hi, I got a new version of YGOT and now EmitJSON functionality is broken. You changed Validate() to ΛValidate(). So now if I have 100s of these Validate calls I have to modify all of them? And not just modify but have both ΛValidate and Validate to support old version and the newest of YGOT?

    In fact I do not even use this Validate() API at all, I do not need to, the JSON input and output is getting validated outside of YGOT library in my case, but the you forcing to use this API.

    There is skipValidation flag that is useless if there is no ΛValidate() defined.

    I want to propose to use this flag to ignore this Validate APIs completely. If this skipValidationis set then skip any checking for ΛValidate or Validate existence at all.

    ` func EmitJSON(gs GoStruct, opts *EmitJSONConfig) (string, error) {

    .... if !skipValidation { s, ok := gs.(validatedGoStruct) if !ok { return "", fmt.Errorf("input GoStruct does not have ΛValidate() method") } if err := s.ΛValidate(vopts...); err != nil { return "", fmt.Errorf("validation err: %v", err) } } `

    Please do not just break API that are working. Now I need to fix hundreds of lines of code for now reason and add thousands of line of dead code to make one api call happy


    opened by CmeRR4 1
  • Refactor how path structs are split.

    Refactor how path structs are split.

    * (M) ypathgen/pathgen.go
     * (M) ypathgen/pathgen_test.go
       - Change splits to include N structs per file based on iterating
         through them rather than precalculating.
       - Avoid creating files that are just the package header.
     * (A) ypathgen/testdata/splitstructs/*
       - Add new test case files.
       - Remove files that contained only the header.
    opened by robshakir 7
  • v0.24.4(Sep 14, 2022)

    What's Changed

    • Utility to Unmarshal SetRequest and Notifications to a root GoStruct. by @wenovus in https://github.com/openconfig/ygot/pull/726

    Full Changelog: https://github.com/openconfig/ygot/compare/v0.24.3...v0.24.4

    Source code(tar.gz)
    Source code(zip)
  • v0.24.3(Sep 1, 2022)

    What's Changed

    • Run gofmt on the codebase. by @robshakir in https://github.com/openconfig/ygot/pull/722
    • Support PreferShadowPath for ygot.Diff. by @wenovus in https://github.com/openconfig/ygot/pull/723

    Full Changelog: https://github.com/openconfig/ygot/compare/v0.24.1...v0.24.3

    Source code(tar.gz)
    Source code(zip)
  • v0.24.2(Aug 5, 2022)

    What's Changed

    • Use [email protected] by @wenovus in https://github.com/openconfig/ygot/pull/718
    • Add Go generation flag ignore_unsupported by @wenovus in https://github.com/openconfig/ygot/pull/712

    Full Changelog: https://github.com/openconfig/ygot/compare/v0.24.0...v0.24.2

    Source code(tar.gz)
    Source code(zip)
  • v0.24.1(Jul 25, 2022)

    What's Changed

    • Use [email protected] by @wenovus in https://github.com/openconfig/ygot/pull/718
    • Add Go generation flag ignore_unsupported by @wenovus in https://github.com/openconfig/ygot/pull/712

    Full Changelog: https://github.com/openconfig/ygot/compare/v0.24.0...v0.24.1

    Source code(tar.gz)
    Source code(zip)
  • v0.24.0(Jul 20, 2022)

    Backwards-Incompatible Changes (util)

    • Rename util.SchemaTreeRoot -> util.TopLevelModule by @wenovus in https://github.com/openconfig/ygot/pull/709

    Other Changes

    • Update gnmi repo and support unmarshalling double_val by @wenovus in https://github.com/openconfig/ygot/pull/714

    Full Changelog: https://github.com/openconfig/ygot/compare/v0.23.1...v0.24.0

    Source code(tar.gz)
    Source code(zip)
  • v0.23.1(Jun 16, 2022)

    What's Changed

    • Add ability split path structs into multiple files when splitting by modules by @DanG100 in https://github.com/openconfig/ygot/pull/707

    Full Changelog: https://github.com/openconfig/ygot/compare/v0.23.0...v0.23.1

    Source code(tar.gz)
    Source code(zip)
  • v0.23.0(Jun 9, 2022)

    This release contains a major refactoring of existing code generation functions and types that has many backwards-incompatible changes for the ygen package in anticipation of a v1 release later this year. Generated code is not affected since the previous release apart from a bug fix to proto generation.

    Backwards-Incompatible Changes (ygen)

    • Merge MappedType's UnionTypeInfo into UnionTypes. by @wenovus in https://github.com/openconfig/ygot/pull/684
    • Split Go generation into gogen package. by @wenovus in https://github.com/openconfig/ygot/pull/695
    • Split Proto generation into protogen package. https://github.com/openconfig/ygot/pull/696
    • Delete StoreRawSchema from GeneratorConfig since it's not being used https://github.com/openconfig/ygot/pull/705
    • Reorganize Code Generation flags and Delete ygen.GeneratorConfig https://github.com/openconfig/ygot/pull/706
    • Delete YANGCodeGenerator.GetDirectoriesAndLeafTypes https://github.com/openconfig/ygot/pull/694
    • Several changes to the IR definition.

    What's Changed

    • Remove expectation that nil maps and slices (YANG lists) are initialized by BuildEmptyTree by @wenovus in https://github.com/openconfig/ygot/pull/702
    • Codify that nil map marshals to null in JSON by @wenovus in https://github.com/openconfig/ygot/pull/701
    • Update generated (u)?exampleoc and dependent tests. by @robshakir in https://github.com/openconfig/ygot/pull/704
    • Make EnumeratedYANGType.IdentityBaseName exported. by @wenovus in https://github.com/openconfig/ygot/pull/688

    Full Changelog: https://github.com/openconfig/ygot/compare/v0.22.1...v0.23.0

    • For a full list of changes, see PRs #688 - #706 inclusive.
    Source code(tar.gz)
    Source code(zip)
  • v0.22.1(May 27, 2022)

    Backwards-Incompatible Changes

    • trim_path_package_oc_prefix is changed to trim_path_package_prefix for PathStruct generation

    What's Changed

    • allow an arbitrary prefix to be trimmed from package names by @greg-dennis in https://github.com/openconfig/ygot/pull/682
    • Fix MergeEmptyMap for MergeStructs and add schema_test by @wenovus in https://github.com/openconfig/ygot/pull/686
    • Change -trim_package_prefix to -trim_path_package_prefix by @wenovus in https://github.com/openconfig/ygot/pull/687

    Full Changelog: https://github.com/openconfig/ygot/compare/v0.21.0...v0.22.1

    Source code(tar.gz)
    Source code(zip)
  • v0.21.0(May 25, 2022)

    Backwards-Incompatible Changes

    • Delete enum flags for proto_generator by @wenovus in https://github.com/openconfig/ygot/pull/667
      • -typedef_enum_with_defmod and -consistent_union_enum_names have been deleted and are now true by default.

    What's Changed

    • Add MergeOpt MergeEmptyMaps to allow an empty map to be merged. by @wenovus in https://github.com/openconfig/ygot/pull/685
    • GenerateProto3 uses IR for Code Generation.
      • NOTE: Some of the new ygen types (e.g. ProtoLangMapper) will be moved to a new package in the near future.
      • Rename protoGenState to ProtoLangMapper by @wenovus in https://github.com/openconfig/ygot/pull/668
      • Change IR.Enums map's key to be a unique key instead of the enum's name. by @wenovus in https://github.com/openconfig/ygot/pull/669
      • Add MappedType.UnionTypeInfos by @wenovus in https://github.com/openconfig/ygot/pull/670
      • Full ProtoLangMapper Support for GenerateIR and add proto IR tests in genir_test.go by @wenovus in https://github.com/openconfig/ygot/pull/671

    Full Changelog: https://github.com/openconfig/ygot/compare/v0.20.2...v0.21.0

    Source code(tar.gz)
    Source code(zip)
  • v0.20.2(May 23, 2022)

    What's Changed

    • Add ConfigFalse field to IR's ParsedDirectories. by @wenovus in https://github.com/openconfig/ygot/pull/681
    • Add ShadowSchemaPath field to IR's YANGDetails. by @wenovus in https://github.com/openconfig/ygot/pull/683

    Full Changelog: https://github.com/openconfig/ygot/compare/v0.20.1...v0.20.2

    Source code(tar.gz)
    Source code(zip)
  • v0.20.1(May 20, 2022)

    What's Changed

    • Generate Path API using IR. by @wenovus in https://github.com/openconfig/ygot/pull/657

    Full Changelog: https://github.com/openconfig/ygot/compare/v0.20.0...v0.20.1

    Source code(tar.gz)
    Source code(zip)
  • v0.20.0(May 9, 2022)


    • ytypes.UnmarshalFunc and ytypes.MergeStructs now take in ygot.GoStruct instead of ygot.ValidatedGoStruct. This may break existing code.
    • All backwards-incompatible changes (except a minor change https://github.com/openconfig/ygot/pull/658) made since v0.17.0 are now reverted or made compatible once again.

    What's Changed

    • Un-deprecate ygot.GoStruct (pre-v0.17.0) and revert the definition of ygot.ValidatedGoStruct to pre-v0.18.0 by @wenovus in https://github.com/openconfig/ygot/pull/664

    NOTE: This change is backwards-incompatible because of the following:

    • it reverts the definition of ygot.ValidatedGoStruct that was changed in v0.18.0. It further reverts the remaining backwards-incompatible changes made in v0.18.1 and v0.17.0.
    • ytypes.UnmarshalFunc and ytypes.MergeStructs now take in ygot.GoStruct instead of ygot.ValidatedGoStruct.

    Full Changelog: https://github.com/openconfig/ygot/compare/v0.19.0...v0.20.0

    Source code(tar.gz)
    Source code(zip)
  • v0.19.0(May 5, 2022)

    What's Changed

    • Update IR to Support Go Generation by @wenovus in https://github.com/openconfig/ygot/pull/650
    • Convert GenerateGoCode to use IR for Code Generation. by @wenovus in https://github.com/openconfig/ygot/pull/651
    • workaround for map declaration limit (ΛEnumTypes) by @steiler in https://github.com/openconfig/ygot/pull/641
    • Add new Fields to IR to support path API generation by @wenovus in https://github.com/openconfig/ygot/pull/655
    • Rename ResolvedPath to LeafrefTargetPath by @wenovus in https://github.com/openconfig/ygot/pull/658
    • Improve ΛBelongingModule() comment by @wenovus in https://github.com/openconfig/ygot/pull/659
    • Add a new JSON unmarshal option that prefers the shadow path values. by @wenovus in https://github.com/openconfig/ygot/pull/661
    • Allow JSON input for ytypes.SetNode by @wenovus in https://github.com/openconfig/ygot/pull/662

    Full Changelog: https://github.com/openconfig/ygot/compare/v0.18.1...v0.19.0

    Source code(tar.gz)
    Source code(zip)
  • v0.18.1(Apr 26, 2022)

    Breaking Changes

    • If you currently use the Validate() in the ygot.ValidatedGoStruct interface, you must change these calls to ΛValidate().

    What's Changed

    • Add code to generate IR (not used). by @wenovus in https://github.com/openconfig/ygot/pull/644
    • Rename goGenState to GoLangMapper. by @wenovus in https://github.com/openconfig/ygot/pull/646
    • rename Validate to ΛValidate by @steiler in https://github.com/openconfig/ygot/pull/643

    New Contributors

    • @steiler made their first contribution in https://github.com/openconfig/ygot/pull/643

    Full Changelog: https://github.com/openconfig/ygot/compare/v0.18.0...v0.18.1

    Source code(tar.gz)
    Source code(zip)
  • v0.18.0(Apr 25, 2022)

    What's Changed

    • Presence Containers (JSON marshalling/unmarshalling support) by @hansthienpondt in https://github.com/openconfig/ygot/pull/645
    • Remove log that is always generated for annotation fields. by @robshakir in https://github.com/openconfig/ygot/pull/652
    • Create FindShadowSchemaPath by @DanG100 in https://github.com/openconfig/ygot/pull/654
    • Revert behaviour to not prepend non-root top-level fields in JSON rendering by @wenovus in https://github.com/openconfig/ygot/pull/653

    NOTE: This release reverts the default JSON rendering behaviour to v0.16.3 due to unclear RFC specification in discussion at https://github.com/openconfig/ygot/pull/648.

    Full Changelog: https://github.com/openconfig/ygot/compare/v0.17.0...v0.18.0

    Source code(tar.gz)
    Source code(zip)
  • v0.17.0(Apr 13, 2022)

    What's Changed

    • Don't prepend module name for in-namespace fields of a non-root-level GoStruct https://github.com/openconfig/ygot/pull/638.
    • Deprecate the GoStruct interface. It is now replaced by the ValidatedGoStruct interface. In spite of its name, this interface is intended to encompass all methods of all Go structs that are always generated regardless of what generation flag is used (ref).

    Full Changelog: https://github.com/openconfig/ygot/compare/v0.16.3...v0.17.0

    Source code(tar.gz)
    Source code(zip)
  • v0.16.3(Mar 31, 2022)

    What's Changed

    • Fix leaf-list Unmarshal to replace instead of appending values. by @wenovus in https://github.com/openconfig/ygot/pull/635

    Full Changelog: https://github.com/openconfig/ygot/compare/v0.16.2...v0.16.3

    Source code(tar.gz)
    Source code(zip)
  • v0.16.2(Mar 24, 2022)

    What's Changed

    • Update uexampleoc's update.sh generation flags by @wenovus in https://github.com/openconfig/ygot/pull/633
    • Add option for RFC7951JSONConfig to prepend module names only for identityrefs by @wenovus in https://github.com/openconfig/ygot/pull/631
      • NOTE: This is a non-standard behaviour and should not be used for any implementation aiming to utilize standard RFC7951 behaviour.
    • [cosmetic]: Change relevant instances of append -> prepend by @wenovus in https://github.com/openconfig/ygot/pull/632

    Full Changelog: https://github.com/openconfig/ygot/compare/v0.16.1...v0.16.2

    Source code(tar.gz)
    Source code(zip)
  • v0.16.1(Mar 22, 2022)

    What's Changed

    • Sanitise defVal for enumDefaultValue() by @hansthienpondt in https://github.com/openconfig/ygot/pull/630
    • Add Go Reference badge by @wenovus in https://github.com/openconfig/ygot/pull/629

    New Contributors

    • @hansthienpondt made their first contribution in https://github.com/openconfig/ygot/pull/630

    Full Changelog: https://github.com/openconfig/ygot/compare/v0.16.0...v0.16.1

    Source code(tar.gz)
    Source code(zip)
  • v0.16.0(Mar 15, 2022)

    What's Changed

    • Specify latest release of staticcheck rather than HEAD. by @robshakir in https://github.com/openconfig/ygot/pull/624
    • Fix leaf-list validation when it is a relative path leafref by @wenovus and @hansthienpondt in https://github.com/openconfig/ygot/pull/626

    Note: There is a backwards-incompatible change in util.ForEachField if you use NodeInfo.PathFromParent, where compressed list (map/slice) elements no longer have a trimmed path.

    Full Changelog: https://github.com/openconfig/ygot/compare/v0.15.1...v0.16.0

    Source code(tar.gz)
    Source code(zip)
  • v0.15.1(Feb 23, 2022)

  • v0.15.0(Feb 22, 2022)

    NOTE: The minor version has been incremented due to this backwards-incompatible change (https://github.com/openconfig/goyang/pull/139) made in [email protected]

    What's Changed

    • Fix doc typos in flag names by @wenovus in https://github.com/openconfig/ygot/pull/620
    • Support leaf-list defaults using latest version of goyang. by @wenovus in https://github.com/openconfig/ygot/pull/618
    • Now using [email protected].

    Full Changelog: https://github.com/openconfig/ygot/compare/v0.14.0...v0.15.0

    Source code(tar.gz)
    Source code(zip)
  • v0.14.0(Jan 24, 2022)

    What's Changed

    • Fix BGP demo. by @robshakir in https://github.com/openconfig/ygot/pull/616
    • Update goyang dep to v0.4.0. by @wenovus in https://github.com/openconfig/ygot/pull/617
      • This change included a potentially disruptive goyang backwards-incompatible update, see https://github.com/openconfig/goyang/pull/188#issue-948067366.

    Full Changelog: https://github.com/openconfig/ygot/compare/v0.13.2...v0.14.0

    Source code(tar.gz)
    Source code(zip)
  • v0.13.2(Jan 14, 2022)

    What's Changed

    • Field numbers for multi-key leafs pointing to the same field should be unique. by @wenovus in https://github.com/openconfig/ygot/pull/610

    Full Changelog: https://github.com/openconfig/ygot/compare/v0.13.1...v0.13.2

    Source code(tar.gz)
    Source code(zip)
  • v0.13.1(Jan 6, 2022)

    What's Changed

    • Add Go generation flag generate_populate_defaults. by @wenovus in https://github.com/openconfig/ygot/pull/607

    Full Changelog: https://github.com/openconfig/ygot/compare/v0.13.0...v0.13.1

    Source code(tar.gz)
    Source code(zip)
  • v0.13.0(Dec 23, 2021)

    What's Changed

    • Do not Clone PathElems when creating a map value's path. by @wenovus in https://github.com/openconfig/ygot/pull/609

    Full Changelog: https://github.com/openconfig/ygot/compare/v0.12.6...v0.13.0

    Source code(tar.gz)
    Source code(zip)
  • v0.12.6(Nov 30, 2021)

    What's Changed

    • Skip choice and case statements when searching leafref paths. by @wenovus in https://github.com/openconfig/ygot/pull/586
    • Improve generated doc comments for goPathChildConstructorTemplate. by @wenovus in https://github.com/openconfig/ygot/pull/602
    • Use reflect.DeepEqual instead of cmp.Equal. by @wenovus in https://github.com/openconfig/ygot/pull/606
    • Add check for empty origin special case by @DanG100 in https://github.com/openconfig/ygot/pull/608

    Full Changelog: https://github.com/openconfig/ygot/compare/v0.12.5...v0.12.6

    Source code(tar.gz)
    Source code(zip)
  • v0.12.5(Nov 9, 2021)

    What's Changed

    • [ypathgen]: Reduce code snippet size in TestGenerateDirectorySnippet. by @wenovus in https://github.com/openconfig/ygot/pull/598
    • Fix static analysis errors. by @robshakir in https://github.com/openconfig/ygot/pull/603
    • Replace IsConfig()'s implementation with goyang's ReadOnly(). by @wenovus in https://github.com/openconfig/ygot/pull/604
    • Add ygot.PruneConfigFalse(*yang.Entry, GoStruct) for pruning "config false" values. by @wenovus in https://github.com/openconfig/ygot/pull/600
    • Add util function PathMatchesQuery by @DanG100 in https://github.com/openconfig/ygot/pull/601

    Full Changelog: https://github.com/openconfig/ygot/compare/v0.12.4...v0.12.5

    Source code(tar.gz)
    Source code(zip)
  • v0.12.4(Oct 14, 2021)

  • v0.12.3(Oct 13, 2021)

"there" also called "GoThere" aims to be a simple Go Library to reduce redundant code for REST APIs.

there "there" also called "GoThere" aims to be a simple Go Library to reduce redundant code for REST APIs. Despite the existence of the other librarie

Christoph Krassnigg 37 Sep 19, 2022
A compute service that lets you run code without provisioning or managing servers

AWS Lambda for Go Lambda is a compute service that lets you run code without provisioning or managing servers. Lambda runs your code on a high-availab

Ibrahim Dauda 0 Oct 13, 2021
Pulumi - Modern Infrastructure as Code. Any cloud, any language 🚀

Pulumi's Infrastructure as Code SDK is the easiest way to create and deploy cloud software that use containers, serverless functions, hosted services,

Pulumi 13.7k Sep 22, 2022
Go client library for efficient postal code lookup (powered by GeoNames)

go-poco Client library for efficient postal code lookup (powered by GeoNames) Installation go-poco may be installed using the go get command: go get g

PGHQ 1 Dec 23, 2021
Fetch input data for Advent of Code challenges.

Import the inputs for Advent of Code challenges straight into your code. Fetched data is cached by default. Usage Log into Advent of Code from your br

Jonathan Chow 4 Feb 15, 2022
An unofficial package in Golang to help developers implement ZATCA (Fatoora) QR code easily.

Zatca SDK GO An unofficial package in Golang to help developers to implement ZATCA (Fatoora) QR code easily which required for e-invoicing ✅ The hash

null 16 Sep 5, 2022
Us-api: a simple service that returns the US state code based on the state

us-api us-api is a simple service that returns the US state code based on the state. It does not support creating, updating nor deleting data. Local D

Alec Cunningham 0 Dec 13, 2021
Example code to demonstrate how to mock external clients via context.Context

Mocking external client libraries using context.Context This code is paired with a blog post: Mocking external client libraries using context.Context

incident.io 2 Feb 22, 2022
This repository will have code implemented for the 100 days of golang.

golang_100 This repository will have code implemented for the 100 days of golang. The resources I will use to do this 100 days golang programming are:

Vasileios Tsakalos 0 Jan 10, 2022
Source code for trevor-edris.io

about-me - Source code for trevor-edris.io A large majority of the base code for this project has been adapted from https://github.com/mikestefanello/

Trevor Edris 0 Jan 20, 2022
Bitfield - A collection of code samples, listings, and solutions to challenges from the book For the Love of Go

For the Love of Go - code listings This is a collection of code samples, listing

Zack Proser 1 Jan 10, 2022
Sion code for review.

Sion Sion is an elastic, high-performance, cost-effective cloud storage that is built atop ephemeral cloud funtions. Prepare EC2 Proxy Amazon EC2 AMI:

null 0 Jan 13, 2022
Cleanv - Golang SDK for Vue Projects. It is able to structure a clean code/arch pattern

Cleanv - Golang SDK for Vue Projects Why? This project is part of my personal portfolio, so, I'll be happy if you could provide me any feedback about

Vinícius Boscardin 6 Apr 24, 2022
Aws-cognito-demo-go - Source code for AWS Cognito in Go

AWS Cognito Demo in Go Source code for YouTube series, AWS Cognito in Go - https

null 2 Aug 31, 2022
Edtienda - PayPal Integration Course Code

PayPal Integration Para ejecutar el código debes realizar los siguientes pasos:

EDteam 1 Feb 3, 2022
This package includes various utilities and extensions for your Go code.

Go utilities This package includes various utilities and extensions for your Go code. Inspired by lodash Install go get github.com/murat/[email protected]

Murat Bastas 2 May 11, 2022
A Protocol Buffers compiler that generates optimized marshaling & unmarshaling Go code for ProtoBuf APIv2

vtprotobuf, the Vitess Protocol Buffers compiler This repository provides the protoc-gen-go-vtproto plug-in for protoc, which is used by Vitess to gen

PlanetScale 508 Sep 25, 2022
Struct for marshaling and unmarshaling glTF

glTF Struct for marshaling and unmarshaling glTF go get github.com/sturfeeinc/glTF/model It's autogenerated code from official work group's specs. Don

null 17 Apr 5, 2020
Package ethernet implements marshaling and unmarshaling of IEEE 802.3 Ethernet II frames and IEEE 802.1Q VLAN tags. MIT Licensed.

ethernet Package ethernet implements marshaling and unmarshaling of IEEE 802.3 Ethernet II frames and IEEE 802.1Q VLAN tags. MIT Licensed. For more in

Matt Layher 245 Sep 27, 2022
YANG parser and compiler to produce Go language objects

Current support for goyang is for the latest 3 Go releases. goyang YANG parser and compiler for Go programs. The yang package (pkg/yang) is used to co

OpenConfig 200 Sep 17, 2022