Documentation
¶
Index ¶
- func EmbeddedTemplates() fs.FS
- func GenerateHTML(ctx context.Context, source pkgopenapi.Source, ...) ([]byte, error)
- func GenerateHTMLFromDocument(ctx context.Context, doc pkgopenapi.Document, operationID, rendererName string, ...) ([]byte, error)
- func NewLoader(options ...pkgopenapi.LoaderOption) pkgopenapi.Loader
- func NewOrchestrator(options ...orchestrator.Option) *orchestrator.Orchestrator
- func NewParser(options ...pkgopenapi.ParserOption) pkgopenapi.Parser
- func RuntimeAssetsFS() fs.FS
- func WithEndpointOverrides(overrides []EndpointOverride) orchestrator.Option
- func WithThemeFallbacks(fallbacks map[string]string) orchestrator.Option
- func WithThemeProvider(provider theme.ThemeProvider, defaultTheme, defaultVariant string) orchestrator.Option
- func WithThemeSelector(selector theme.ThemeSelector) orchestrator.Option
- type EndpointAuth
- type EndpointConfig
- type EndpointMapping
- type EndpointOverride
- type FieldSubset
- type RenderOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EmbeddedTemplates ¶
EmbeddedTemplates exposes the built-in vanilla renderer templates so callers can reuse or extend them without importing the renderer package directly.
func GenerateHTML ¶
func GenerateHTML(ctx context.Context, source pkgopenapi.Source, operationID, rendererName string, options ...orchestrator.Option) ([]byte, error)
GenerateHTML loads the OpenAPI source, builds a form model for the requested operation, and renders it using the named renderer. It is the simplest entry point for callers that just want HTML output.
func GenerateHTMLFromDocument ¶
func GenerateHTMLFromDocument(ctx context.Context, doc pkgopenapi.Document, operationID, rendererName string, options ...orchestrator.Option) ([]byte, error)
GenerateHTMLFromDocument renders a form using a pre-loaded document, bypassing the loader stage while still delegating to the orchestrator.
func NewLoader ¶
func NewLoader(options ...pkgopenapi.LoaderOption) pkgopenapi.Loader
NewLoader constructs a loader using the internal implementation while keeping the concrete type hidden from consumers.
func NewOrchestrator ¶
func NewOrchestrator(options ...orchestrator.Option) *orchestrator.Orchestrator
NewOrchestrator exposes the orchestrator constructor from the top-level module, mirroring the quick start guidance in go-form-gen.md:223-258.
func NewParser ¶
func NewParser(options ...pkgopenapi.ParserOption) pkgopenapi.Parser
NewParser constructs a parser backed by the internal implementation.
func RuntimeAssetsFS ¶ added in v0.6.0
RuntimeAssetsFS exposes the prebuilt browser runtime bundles (committed under pkg/runtime/assets) so Go applications can serve them without an npm build step.
Typical mount:
mux.Handle("/runtime/",
http.StripPrefix("/runtime/",
http.FileServerFS(formgen.RuntimeAssetsFS()),
),
)
func WithEndpointOverrides ¶
func WithEndpointOverrides(overrides []EndpointOverride) orchestrator.Option
WithEndpointOverrides registers endpoint overrides that can be passed to GenerateHTML alongside other orchestrator options.
func WithThemeFallbacks ¶
func WithThemeFallbacks(fallbacks map[string]string) orchestrator.Option
WithThemeFallbacks forwards fallback partials used when deriving renderer configuration from a theme selection.
func WithThemeProvider ¶
func WithThemeProvider(provider theme.ThemeProvider, defaultTheme, defaultVariant string) orchestrator.Option
WithThemeProvider constructs a go-theme selector from a ThemeProvider and registers it with the orchestrator so renderers receive resolved partials, tokens, and assets.
func WithThemeSelector ¶
func WithThemeSelector(selector theme.ThemeSelector) orchestrator.Option
WithThemeSelector passes a go-theme selector through to the orchestrator so theme/variant choices can be resolved ahead of rendering.
Types ¶
type EndpointAuth ¶
type EndpointAuth = orchestrator.EndpointAuth
EndpointAuth describes runtime authentication hints.
type EndpointConfig ¶
type EndpointConfig = orchestrator.EndpointConfig
EndpointConfig mirrors the x-endpoint contract; alias exported via the root package for convenience.
type EndpointMapping ¶
type EndpointMapping = orchestrator.EndpointMapping
EndpointMapping remaps endpoint payload fields.
type EndpointOverride ¶
type EndpointOverride = orchestrator.EndpointOverride
EndpointOverride configures manual endpoint metadata for a form field.
type FieldSubset ¶
type FieldSubset = render.FieldSubset
FieldSubset aliases render.FieldSubset for callers configuring partial rendering by group/tag/section.
type RenderOptions ¶
type RenderOptions = render.RenderOptions
RenderOptions describes per-request overrides that renderers can use to prefill values or surface server-side validation errors.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
formgen-cli
command
|
|
|
formgen-lint-extensions
command
|
|
|
components
|
|
|
timezones
Package timezones provides deterministic IANA timezone data, search helpers, and a small net/http handler that returns JSON options for form inputs.
|
Package timezones provides deterministic IANA timezone data, search helpers, and a small net/http handler that returns JSON options for form inputs. |
|
examples
|
|
|
basic
command
|
|
|
cli
command
|
|
|
multi-renderer
command
|
|
|
internal
|
|
|
pkg
|
|
|
model
Package model defines the typed form model consumed by renderers, following the structure documented in go-form-gen.md:97-158.
|
Package model defines the typed form model consumed by renderers, following the structure documented in go-form-gen.md:97-158. |
|
openapi
Package openapi exposes the public contracts for loader and parser stages, mirroring the wrapper strategy described in go-form-gen.md:25-159 and go-form-gen.md:304-357.
|
Package openapi exposes the public contracts for loader and parser stages, mirroring the wrapper strategy described in go-form-gen.md:25-159 and go-form-gen.md:304-357. |
|
orchestrator
Package orchestrator wires the loader → parser → model builder → renderer pipeline described in go-form-gen.md:25-258, providing dependency injection friendly helpers for consumers that prefer a single entry point.
|
Package orchestrator wires the loader → parser → model builder → renderer pipeline described in go-form-gen.md:25-258, providing dependency injection friendly helpers for consumers that prefer a single entry point. |
|
render
Package render hosts renderer interfaces and registry helpers, matching the extensibility goals detailed in go-form-gen.md:137-159 and go-form-gen.md:223-239.
|
Package render hosts renderer interfaces and registry helpers, matching the extensibility goals detailed in go-form-gen.md:137-159 and go-form-gen.md:223-239. |
|
render/template
Package template defines renderer-agnostic template interfaces and adapters.
|
Package template defines renderer-agnostic template interfaces and adapters. |
|
schema
Package schema defines format-agnostic schema types and adapter contracts.
|
Package schema defines format-agnostic schema types and adapter contracts. |
|
uischema
Package uischema loads and applies UI schema decorators that enrich formgen form models with layout metadata, section assignments, and action definitions.
|
Package uischema loads and applies UI schema decorators that enrich formgen form models with layout metadata, section assignments, and action definitions. |
|
scripts
|
|
|
generate-article-form
command
|
|
|
generate-form-model
command
|