mirror of
https://github.com/LukeHagar/libopenapi.git
synced 2025-12-06 04:20:11 +00:00
Updated example code and readme to help explain encoding issues #34
Signed-off-by: Dave Shanley <dave@quobix.com>
This commit is contained in:
@@ -302,9 +302,11 @@ import (
|
||||
)
|
||||
|
||||
// define an example struct representing a cake
|
||||
// super important to remember to use hints/meta-data to map properties correctly.
|
||||
type cake struct {
|
||||
Candles int
|
||||
Frosting string
|
||||
Candles int `yaml:"candles"`
|
||||
Frosting string `yaml:"frosting"`
|
||||
Some_Strange_Var_Name string `yaml:"someStrangeVarName"`
|
||||
}
|
||||
|
||||
// define a struct that holds a map of cake pointers.
|
||||
@@ -340,6 +342,7 @@ func main() {
|
||||
someCake:
|
||||
candles: 10
|
||||
frosting: blue
|
||||
someStrangeVarName: mapping is required to extract these.
|
||||
anotherCake:
|
||||
candles: 1
|
||||
frosting: green
|
||||
|
||||
@@ -546,8 +546,9 @@ func ExampleNewDocument_unpacking_extensions() {
|
||||
|
||||
// define an example struct representing a cake
|
||||
type cake struct {
|
||||
Candles int
|
||||
Frosting string
|
||||
Candles int `yaml:"candles"`
|
||||
Frosting string `yaml:"frosting"`
|
||||
Some_Strange_Var_Name string `yaml:"someStrangeVarName"`
|
||||
}
|
||||
|
||||
// define a struct that holds a map of cake pointers.
|
||||
@@ -580,6 +581,7 @@ components:
|
||||
someCake:
|
||||
candles: 10
|
||||
frosting: blue
|
||||
someStrangeVarName: something
|
||||
anotherCake:
|
||||
candles: 1
|
||||
frosting: green
|
||||
|
||||
Reference in New Issue
Block a user