gen

package
v1.40.5 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package gen provides code generation from OpenAPI specs.

Index

Constants

View Source
const (
	// Unified spec paths (v1+v2 combined in single files)
	PathUnifiedSpec        = "../../api/openapi-spec/spec3.cli.json"
	PathUnifiedPreviewSpec = "../../api/openapi-spec/spec3.cli.preview.json"
)

OpenAPI spec file paths shared across code generation tools

Variables

This section is empty.

Functions

func FirstSentence added in v1.40.4

func FirstSentence(s string) string

FirstSentence returns the first sentence of s using a lightweight heuristic. Paragraph breaks ("\n\n") are always a boundary. Otherwise it splits on ". " or ".\n" where canEndSentence holds for the character before the period and canStartSentence holds for the character after the separator. Known abbreviations (e.g., "e.g", "i.e") are never split on.

func GetType

func GetType(schema *spec.Schema) *string

GetType accepts a schema and returns its scalar type, if it has one.

If the schema is monomorphic, it returns its type if it's scalar.

If the schema is polymorphic, it returns the first scalar type for the schema, if there is any.

func IsClearableObject added in v1.40.3

func IsClearableObject(s *spec.Schema) bool

IsClearableObject reports whether s uses the anyOf clearable-object pattern: one object branch and one empty-string-only branch. This is the Stripe v1 API convention for optional nested objects that can be removed by passing "".

func ResolveObjectSchema added in v1.40.3

func ResolveObjectSchema(s *spec.Schema) *spec.Schema

ResolveObjectSchema returns s if it is a plain object schema (type "object" or has Properties), or the first anyOf/oneOf branch that is an object schema. Returns nil if no object branch is found.

Types

This section is empty.

Jump to

Keyboard shortcuts

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