File: extensions.go

package info (click to toggle)
golang-github-emicklei-go-restful 3.10.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 792 kB
  • sloc: makefile: 9; sh: 6
file content (21 lines) | stat: -rw-r--r-- 723 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package restful

// Copyright 2021 Ernest Micklei. All rights reserved.
// Use of this source code is governed by a license
// that can be found in the LICENSE file.

// ExtensionProperties provides storage of vendor extensions for entities
type ExtensionProperties struct {
	// Extensions vendor extensions used to describe extra functionality
	// (https://swagger.io/docs/specification/2-0/swagger-extensions/)
	Extensions map[string]interface{}
}

// AddExtension adds or updates a key=value pair to the extension map.
func (ep *ExtensionProperties) AddExtension(key string, value interface{}) {
	if ep.Extensions == nil {
		ep.Extensions = map[string]interface{}{key: value}
	} else {
		ep.Extensions[key] = value
	}
}