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

formats

package
v0.4.0 Latest Latest
Warning

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

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

Documentation

Overview

Package formats holds the names of the OpenAPI Format Registry (https://spec.openapis.org/registry/format/), the values the JSON Schema "format" keyword may take in an OpenAPI description. A registry entry is a convention, not part of the specification: a tool may support none of it, and a format that is not in the list is legal (it is an annotation). A dated copy is kept here so an offline tool can say which formats it recognises; the list changes when the registry does.

Index

Constants

View Source
const RegistryDate = "2026-10-29"

RegistryDate is the day the copy below was taken from the registry.

Variables

This section is empty.

Functions

func Invalid

func Invalid(name string) (string, bool)

Invalid returns a string that does not fit the registered format name: a value to try a server with. It is false for a name with no plain wrong value (most numeric formats are checked by range, not by shape) and for an unregistered one.

func InvalidSamples

func InvalidSamples() []string

InvalidSamples lists the formats Invalid has a sample for, sorted.

func Names

func Names() []string

Names lists every registered format name, sorted.

Types

type Format

type Format struct {
	Name string
	// Types are the JSON Schema types the format applies to, as the registry gives them: it says "number" for integers.
	Types      []string
	Meaning    string
	Deprecated bool
}

Format is one registry entry.

func Lookup

func Lookup(name string) (Format, bool)

Lookup returns the registry entry called name. Names are case-sensitive.

Jump to

Keyboard shortcuts

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