CiscoDevNet / ydk-gen

Generate model-driven APIs from YANG models
http://ciscodevnet.github.io/ydk-gen/
Apache License 2.0
135 stars 74 forks source link

Fix #1098. Support for parsing JSON capabilities. #1099

Closed drewtoto closed 1 day ago

drewtoto commented 4 months ago

Add a CapabilitiesJsonParser for parsing RESTCONF capabilities when JSON encoding is specified.

Add IetfCapabilitiesJsonParser to parse capabilities YANG model defined by ietf-restconf-monitoring:capabilities using JSON encoding. This parses uses included nlohmann::json library.

Add EncodingFormat parameter to RestconfSession::initialize method to enable use of JSON capabilities parser.

The RESTCONF Protocol (RFC 8040) section 5.2 specifies that a server MUST support one of either XML or JSON encoding. A server MAY support both and a client will need to support both XML and JSON. Link: https://datatracker.ietf.org/doc/html/rfc8040#section-5.2.