Help us shape the future of Go! Take the 2026 Go Developer Survey

synthx

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package synthx generates a realistic request body for a documented operation.

It exists because synth has two front doors that do not agree. Its OpenAPI one decides a field's kind from `format` alone, so every plain `type: string` property becomes lorem ipsum no matter what it is called, and a login body comes back as {"password": "eiusmod sed do", "phone_number": "do adipiscing"}. Its JSON Schema front door reads the field *name* first (synth's own infer.Kind knows "password", "phone_number", "timezone"), which is the only signal those fields have. So this package resolves the operation's request body out of the document, emits it as a plain JSON Schema, and generates from that — same library, the front door that reads names.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JSONSchema

func JSONSchema(doc *core.Document, method, path string) ([]byte, error)

JSONSchema renders the operation's request body as a standalone JSON Schema: $refs resolved against the document's components, so nothing is left pointing at a definition the generator cannot see.

func PayloadJSON

func PayloadJSON(doc *core.Document, method, path string) ([]byte, error)

PayloadJSON generates one request body for method+path from doc, as indented JSON. An error means the operation has no JSON request-body object to generate from — the caller's 422.

Types

This section is empty.

Jump to

Keyboard shortcuts

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