Categorygithub.com/ubio/swagger-parser
modulepackage
0.0.21
Repository: https://github.com/ubio/swagger-parser.git
Documentation: pkg.go.dev

# README

Swagger Parser

This repo contains a small utility to parse Swagger files and generate output .md files based on a Go template.

Installation:

go install github.com/ubio/swagger-parser@latest

Arguments:

It can take several arguments as flags:

FlagExampleDescription
name--name apiThe name of the API
template--template template.gohtmlThe Go template file to use
pages--pages ./path/to/pages.yamlThe pages file to use
schema--schema ./path/to/schema.yamlThe schema file to use
output--output ./path/to/output.mdThe output file to write
swagger-parser
    --name api
    --template template.gohtml
    --pages ./path/to/pages.yaml
    --schema ./path/to/schema.yaml
    --output ./path/to/output.md

Pages File

The pages file is an opinionated YAML file that contains the configuration f which pages to generate. For example:

// pets.yaml

pages:
  - name: Pets
    filename: pets.md
    description: |
      Pets are excellent friends. Why not get one via the API.
    paths:
      - method: get
        path: /pets
      - method: post
        path: /pets

Will generate a page and include the GET /pets and POST /pets spec in the output passed to the go template file, where the name and description will also be printed.

Example

go run *.go \
    --name pets \
    --template ./example/template.gohtml \
    --pages ./example/pets.yaml \
    --schema ./example/schema.yaml \
    --output ./example/output

# Packages

No description provided by the author

# Functions

No description provided by the author

# Structs

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Type aliases

No description provided by the author
No description provided by the author
No description provided by the author