embedinheritance

package
v0.36.0 Latest Latest
Warning

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

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

Documentation

Overview

Package embedinheritance exercises the generalized "annotations on an embedded field apply to the members it promotes" rule (go-swagger#2701) beyond parameters: a `required:` annotation on an embed propagates to the promoted properties of a model schema, and of a response body schema (which is built through the same schema builder). Exportedness stays per-field: unexported promoted members never surface, at any depth.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	// contains filtered or unexported fields
}

Base carries the fields promoted into its embedders.

type Widget

type Widget struct {
	// required: true
	Base

	// Extra is a normal field that is NOT required.
	Extra string `json:"extra"`
}

Widget embeds Base with a `required:` annotation on the embed, so the promoted id/name become required on Widget.

swagger:model Widget

Jump to

Keyboard shortcuts

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