Forum Discussion

kennamm's avatar
Occasional Visitor
3 months ago

YANG to OAS conversion

Hi, my client's API developer is using a YANG data model as the base spec and building from there.  As a tech writer I need to convert this to OAS so I can create the API docs. It looks like swaggerhub doesn't have a tool for converting YANG to OAS. Has anyone done this and can they recommend a tool?


2 Replies

  • While there isn't a direct tool for converting YANG to OAS, there are some approaches you can consider:

    1. Manual Conversion: The most straightforward approach is to manually translate the YANG data model into OAS. This involves understanding the structure and semantics of both formats and recreating the API definition in OAS based on the YANG model. While this method can be time-consuming, it allows for greater control and accuracy in the conversion process.
    2. Code Generation: Some tools and libraries may offer code generation capabilities to convert YANG models to OAS. These tools typically analyze the YANG schema and generate corresponding OAS definitions automatically. However, the quality and accuracy of the generated OAS may vary depending on the tool used.
    3. Custom Scripts: If manual conversion or code generation tools are not suitable, you may consider developing custom scripts or utilities to assist with the conversion process. These scripts can parse the YANG model and generate OAS definitions based on predefined mappings and rules.
    4. Consultation with Experts: Depending on the complexity of the YANG model and the requirements of the API documentation, you may benefit from consulting with experts or professionals experienced in both YANG and OAS. They can provide guidance and best practices for converting the YANG model to OAS effectively.