parser

package
v1.10.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 16, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package parser parses API definitions in Go

Package parser parses API definitions in Go

Package parser parses API definitions in Go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Endpoint

type Endpoint struct {
	Method        MethodType
	RawPath, Path string
	Placeholder   string

	RequestPayloadName  string
	ResponsePayloadName string
	RequestPayload      *ast.StructType
	ResponsePayload     *ast.StructType
	// contains filtered or unexported fields
}

Endpoint represents one HTTP endpoint

func (*Endpoint) GetFullPath

func (e *Endpoint) GetFullPath(splitter string, fn func(rawPath, path, placeholder string) string) string

GetFullPath returns the full path foe the endpoint

func (*Endpoint) GetParent

func (e *Endpoint) GetParent() *Group

GetParent returns the parent Group

type Group

type Group struct {
	ImportPath    string
	RawPath, Path string
	Dir           string
	Placeholder   string

	Children  []*Group
	Endpoints []*Endpoint
	// contains filtered or unexported fields
}

Group is a layer for endpoints

func Parse

func Parse(dir string) (*Group, error)

Parse parses

func (*Group) GetFullPath

func (g *Group) GetFullPath(splitter string, fn func(rawPath, path, placeholder string) string) string

GetFullPath returns the full path foe the endpoint

func (*Group) GetParent

func (g *Group) GetParent() *Group

GetParent returns the parent Group

type MethodType

type MethodType string

MethodType represents methods for HTTP

const (
	// GET is GET method for HTTP
	GET MethodType = "GET"
	// POST is POST method for HTTP
	POST MethodType = "POST"
	// PUT is PUT method for HTTP
	PUT MethodType = "PUT"
	// DELETE is method for HTTP
	DELETE MethodType = "DELETE"
	// PATCH is method for HTTP
	PATCH MethodType = "PATCH"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL