demo

package
v0.33.2 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package demo API

Demonstrates type alias handling with the --transparent-aliases flag.

This example shows how type aliases (e.g., type UserID = Identifier) are handled differently:

Without --transparent-aliases (default post-#3227):

  • UserID appears as a definition in swagger.json
  • User.id references #/definitions/UserID

With --transparent-aliases:

  • UserID does NOT appear in definitions
  • User.id references #/definitions/Identifier directly
  • Matches pre-#3227 behavior

To see the difference:

  swagger generate spec -m -o without-flag.json
  swagger generate spec -m --transparent-aliases -o with-flag.json
  diff <(jq . without-flag.json) <(jq . with-flag.json)

	Schemes: https
	Host: localhost
	Version: 1.0.0

	Consumes:
	- application/json

	Produces:
	- application/json

swagger:meta

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Identifier

type Identifier string

Identifier represents a unique identifier

type User

type User struct {
	ID   UserID `json:"id"`
	Name string `json:"name"`
}

User represents a user in the system

type UserID

type UserID = Identifier

UserID is an alias to Identifier for user-specific IDs

type UserResponse

type UserResponse struct {
	// in: body
	Body User
}

UserResponse represents a user response

swagger:response UserResponse

Jump to

Keyboard shortcuts

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