Blame vendor/github.com/getkin/kin-openapi/openapi3/examples.go
|
Packit Service |
3a6627 |
package openapi3
|
|
Packit Service |
3a6627 |
|
|
Packit Service |
3a6627 |
import (
|
|
Packit Service |
3a6627 |
"github.com/getkin/kin-openapi/jsoninfo"
|
|
Packit Service |
3a6627 |
)
|
|
Packit Service |
3a6627 |
|
|
Packit Service |
3a6627 |
// Example is specified by OpenAPI/Swagger 3.0 standard.
|
|
Packit Service |
3a6627 |
type Example struct {
|
|
Packit Service |
3a6627 |
ExtensionProps
|
|
Packit Service |
3a6627 |
|
|
Packit Service |
3a6627 |
Summary string `json:"summary,omitempty" yaml:"summary,omitempty"`
|
|
Packit Service |
3a6627 |
Description string `json:"description,omitempty" yaml:"description,omitempty"`
|
|
Packit Service |
3a6627 |
Value interface{} `json:"value,omitempty" yaml:"value,omitempty"`
|
|
Packit Service |
3a6627 |
ExternalValue string `json:"externalValue,omitempty" yaml:"externalValue,omitempty"`
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
|
|
Packit Service |
3a6627 |
func NewExample(value interface{}) *Example {
|
|
Packit Service |
3a6627 |
return &Example{
|
|
Packit Service |
3a6627 |
Value: value,
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
|
|
Packit Service |
3a6627 |
func (example *Example) MarshalJSON() ([]byte, error) {
|
|
Packit Service |
3a6627 |
return jsoninfo.MarshalStrictStruct(example)
|
|
Packit Service |
3a6627 |
}
|
|
Packit Service |
3a6627 |
|
|
Packit Service |
3a6627 |
func (example *Example) UnmarshalJSON(data []byte) error {
|
|
Packit Service |
3a6627 |
return jsoninfo.UnmarshalStrictStruct(data, example)
|
|
Packit Service |
3a6627 |
}
|