openapi
An easy-to-use vlang module to parse OpenApi3 files into usable structs. This module follows the following specification: OpenApi 3
Installation
From VPM
v install Leiyks.openapi
then import it with:
import Leiyks.openapi
From Github
v install --git https://github.com/Leiyks/openapi
then import it with:
import openapi
Usage
To use this module, you need to load your JSON OpenApi file into a string before parsing it. If you want to parse YAML files instead you can use the following module: yaml
Then you just need to call the decode function to have a usable struct:
import openapi
fn function(path string) ? {
mut content := os.read_file(path)?
open_api := openapi.decode<openapi.OpenApi>(content)?
// Do amazing things
}