openapi

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

+marmot:name=OpenAPI +marmot:description=This plugin discovers OpenAPI v3 specifications. +marmot:status=experimental

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	plugin.BaseConfig `json:",inline"`
	SpecPath          string `json:"spec_path" description:"Path to the directory containing the OpenAPI specifications"`
}

Config for OpenAPI plugin +marmot:config

type EndpointField

type EndpointField struct {
	Deprecated  bool     `json:"deprecated" metadata:"deprecated" description:"Is this endpoint deprecated"`
	Description string   `json:"description" metadata:"description" description:"A verbose explanation of the operation behaviour."`
	StatusCodes []string `json:"status_codes" metadata:"status_codes" description:"All HTTP response status codes that are returned for this endpoint."`
	HTTPMethod  string   `json:"http_method" metadata:"http_method" description:"HTTP method"`
	OperationID string   `json:"operation_id" metadata:"operation_id" description:"Unique identifier of the operation"`
	Path        string   `json:"path" metadata:"path" description:"Path"`
	Summary     string   `json:"summary" metadata:"summary" description:"A short summary of what the operation does"`
}

EndpointField represents endpoints in OpenAPI specifications +marmot:metadata

type JsonSchema

type JsonSchema struct {
	Schema               *string               `json:"$schema,omitempty"`
	Id                   *string               `json:"id,omitempty"`
	Title                *string               `json:"title,omitempty"`
	Description          *string               `json:"description,omitempty"`
	Ref                  *string               `json:"$ref,omitempty"`
	Type                 []string              `json:"type,omitempty"`
	Definitions          map[string]JsonSchema `json:"definitions,omitempty"`
	Properties           map[string]JsonSchema `json:"properties,omitempty"`
	Items                any                   `json:"items,omitempty"`
	AllOf                []*JsonSchema         `json:"allOf,omitempty"`
	AnyOf                []*JsonSchema         `json:"anyOf,omitempty"`
	OneOf                []*JsonSchema         `json:"oneOf,omitempty"`
	Required             []string              `json:"required,omitempty"`
	Enum                 []any                 `json:"enum,omitempty"`
	Example              string                `json:"example,omitempty"`
	Pattern              string                `json:"pattern,omitempty"`
	Format               string                `json:"format,omitempty"`
	Maximum              *float64              `json:"maximum,renderZero,omitempty"`
	Minimum              *float64              `json:"minimum,renderZero,omitempty,"`
	MaxLength            *int64                `json:"maxLength,omitempty"`
	MinLength            *int64                `json:"minLength,omitempty"`
	MaxItems             *int64                `json:"maxItems,omitempty"`
	MinItems             *int64                `json:"minItems,omitempty"`
	UniqueItems          *bool                 `json:"uniqueItems,omitempty"`
	MultipleOf           *float64              `json:"multipleOf,omitempty"`
	Not                  *JsonSchema           `json:"not,omitempty"`
	AdditionalProperties any                   `json:"additionalProperties,omitempty"`
	MaxProperties        *int64                `json:"maxProperties,omitempty"`
	MinProperties        *int64                `json:"minProperties,omitempty"`
	Deprecated           *bool                 `json:"deprecated,omitempty"`
}

func NewJsonSchema

func NewJsonSchema() *JsonSchema

func NewJsonSchemaFromOpenAPISchema

func NewJsonSchemaFromOpenAPISchema(schemaProxy *base.SchemaProxy) (*JsonSchema, error)

func (JsonSchema) MarshalJSON

func (js JsonSchema) MarshalJSON() ([]byte, error)

type OpenAPIFields

type OpenAPIFields struct {
	ContactEmail           string   `json:"contact_email" metadata:"contact_email" description:"Contact email"`
	ContactName            string   `json:"contact_name" metadata:"contact_name" description:"Contact name"`
	ContactURL             string   `json:"contact_url" metadata:"contact_url" description:"Contact URL"`
	Description            string   `json:"description" metadata:"description" description:"Description of the API"`
	ExternalDocs           string   `json:"external_docs" metadata:"external_docs" description:"Link to the external documentation"`
	LicenseIdentifier      string   `json:"license_identifier" metadata:"license_identifier" description:"SPDX license experession for the API"`
	LicenseName            string   `json:"license_name" metadata:"license_name" description:"Name of the license"`
	LicenseURL             string   `json:"license_url" metadata:"license_url" description:"URL of the license"`
	NumDeprecatedEndpoints int      `` /* 141-byte string literal not displayed */
	NumEndpoints           int      `json:"num_endpoints" metadata:"num_endpoints" description:"Number of endpoints in the OpenAPI specification"`
	OpenAPIVersion         string   `json:"openapi_version" metadata:"openapi_version" description:"Version of the OpenAPI spec"`
	Servers                []string `json:"servers" metadata:"servers" description:"URL of the servers of the API"`
	ServiceName            string   `json:"service_name" metadata:"service_name" description:"Name of the service that owns the resource"`
	ServiceVersion         string   `json:"service_version" metadata:"service_version" description:"Version of the service"`
	TermsOfService         string   `json:"terms_of_service" metadata:"terms_of_service" description:"Link to the page that describes the terms of service"`
}

OpenAPIFields represents OpenAPI-specific metadata fields +marmot:metadata

type Source

type Source struct {
	// contains filtered or unexported fields
}

func (*Source) Discover

func (s *Source) Discover(ctx context.Context, pluginConfig plugin.RawPluginConfig) (*plugin.DiscoveryResult, error)

func (*Source) Validate

func (s *Source) Validate(rawConfig plugin.RawPluginConfig) (plugin.RawPluginConfig, error)

Jump to

Keyboard shortcuts

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